Skip to content

Commit

Permalink
Fixed validation on create
Browse files Browse the repository at this point in the history
  • Loading branch information
goodtocode committed Jul 4, 2023
1 parent bf294bb commit da53787
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
namespace Goodtocode.Subjects.BlazorServer.Models;

public class BusinessModel : IBusinessEntity
{
[Required]
public string Name { get; set; } = string.Empty;
{
public Guid BusinessKey { get; set; } = default;
[Required]
public string BusinessName { get; set; } = string.Empty;
public string TaxNumber { get; set; } = string.Empty;
public string Type { get; set; } = string.Empty;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
<DataAnnotationsValidator />
<div class="form-group mb-3">
<label for="businessName">Name</label>
<input type="text" class="form-control" id="businessName" placeholder="Business name" aria-label="Search" aria-describedby="button-addon2"
<input type="text" class="form-control" id="businessName" placeholder="Business name" aria-label="Name" aria-describedby="button-addon2"
@bind="@business.BusinessName">
</div>
<div class="form-group mb-3">
<label for="taxNumber">Tax Number</label>
<input type="text" class="form-control" id="taxNumber" placeholder="Tax Number" @bind-value="@business.TaxNumber">
</div>
<button type="submit" class="btn btn-primary" @onclick="CreateBusineses">Create</button>
<ValidationSummary />
<ValidationSummary class="mt-3" />
<div hidden="@string.IsNullOrEmpty(alertMessage)" class="alert alert-danger" role="alert">@alertMessage</div>
</EditForm>

Expand Down

0 comments on commit da53787

Please sign in to comment.