public static AddressViewModel ToModel(this RAddress address) { if (address == null) { return(null); } return(new AddressViewModel() { Id = address.Id, FullName = address.FullName, CountryId = address.CountryId, CountryName = address.CountryName, Description = address.Description, Detail = address.Detail, DistrictId = address.DistrictId, DistrictName = address.DistrictName, Mobile = address.Mobile, ProvinceId = address.ProvinceId, ProvinceName = address.ProvinceName, StreetId = address.StreetId, StreetName = address.StreetName, WardId = address.WardId, WardName = address.WardName }); }
public void clearConfiguration() { RName.Clear(); RAddress.Clear(); RPhoneNumber.Clear(); pictureBox1.Image = null; buttonSave.Text = "Update"; }
public IHttpActionResult AddAddress([FromBody] RAddress address) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _addressRepository.Add(address); } catch (Exception ex) { throw ex; } return(Ok(address)); }
public IHttpActionResult UpdateAddress(int id, [FromBody] RAddress address) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (address == null) { return(BadRequest("User is null")); } if (id != address.UserID) { return(BadRequest()); } _addressRepository.Update(address); return(Ok(address)); }
public IHttpActionResult DeletAddress(int id) { try { RAddress address = _addressRepository.Get(id); if (address == null) { return(NotFound()); } _addressRepository.Delete(id); } catch (Exception ex) { throw ex; } return(Ok("Record is deleted!")); }