public void UpdateProfile(SalonProfileViewModel model) { var salon = _salonRepo.Gets().FirstOrDefault(s => s.AccountId == model.AccountId); if (salon != null) { if (model.SalonName != null) { salon.Name = model.SalonName; } if (model.Email != null) { salon.Email = model.Email; } if (model.Phone != null) { salon.Phone = model.Phone; } if (model.Address != null) { salon.Address = model.Address; } salon.Capacity = model.Capacity; salon.Longitude = model.Longitude; salon.Latitude = model.Latitude; _salonRepo.Edit(salon); _unitOfWork.SaveChanges(); } }
public IHttpActionResult Post(SalonProfileViewModel model) { try { var identity = (ClaimsIdentity)User.Identity; string accountId = identity.Claims.FirstOrDefault(c => c.Type.Equals("AccountId")).Value; model.AccountId = accountId; _salonService.UpdateProfile(model); return(Ok("Update Profile Success")); } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex); return(BadRequest("Update Profile Failed")); } }