public string UpdateCustomerPofile(CustomerRowViewModel model) { var existedCustomer = _customerRepository.Get(x => x.Username.Equals(model.Username, StringComparison.OrdinalIgnoreCase)); if (existedCustomer == null) { return("Not found customer"); } if (model.FullName != null && !model.FullName.Equals("")) { existedCustomer.FullName = model.FullName; } if (model.Email != null && !model.Email.Equals("")) { existedCustomer.Email = model.Email; } if (model.Address != null && !model.Address.Equals("")) { existedCustomer.Address = model.Address; } existedCustomer.UpdatedAtUTC = DateTime.UtcNow; existedCustomer.IsActive = true; _customerRepository.Update(existedCustomer); try { _unitOfWork.CommitChanges(); } catch (Exception ex) { return(ex.Message); } return(string.Empty); }
public ActionResult UpdateProfileCustomer(CustomerRowViewModel model) { //if (!ModelState.IsValid) //{ // return BadRequest("Invalid Request"); //} var updateResult = _customerService.UpdateCustomerPofile(model); if (!string.IsNullOrEmpty(updateResult)) { return(StatusCode((int)HttpStatusCode.NotAcceptable, updateResult)); } return(Ok()); }
public string UpdateCustomerAuthen(CustomerRowViewModel model) { var existedCustomer = _customerRepository.Get(x => x.Id == model.Id); if (existedCustomer == null) { return("Not found customer"); } existedCustomer.IsActive = model.IsActive; _customerRepository.Update(existedCustomer); try { _unitOfWork.CommitChanges(); } catch (Exception ex) { return(ex.Message); } return(string.Empty); }