public IActionResult Update(int id, UpdateOwnerModel model) { var entity = _service.Owners.Id(id).FirstOrDefault(); if (entity == null) { return(NotFound(new AppResultBuilder().NotFound())); } var validationResult = _service.ValidateUpdateOwner(User, entity, model); if (!validationResult.Valid) { return(BadRequest(validationResult.Result)); } _service.UpdateOwner(entity, model); context.SaveChanges(); return(NoContent()); }
public ValidationResult ValidateUpdateOwner(ClaimsPrincipal principal, Owner entity, UpdateOwnerModel model) { return(ValidationResult.Pass()); }
public void UpdateOwner(Owner entity, UpdateOwnerModel model) { model.CopyTo(entity); }