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());
        }
Esempio n. 2
0
 public ValidationResult ValidateUpdateOwner(ClaimsPrincipal principal,
                                             Owner entity, UpdateOwnerModel model)
 {
     return(ValidationResult.Pass());
 }
Esempio n. 3
0
 public void UpdateOwner(Owner entity, UpdateOwnerModel model)
 {
     model.CopyTo(entity);
 }