public ActionResult Edit(Models.Client client, int id) { if (ModelState.IsValid) { DataAccessLayerCommon.Client Client = clientMapper.MapFromModel(client); clientRepository.Update(id, Client); return(RedirectPermanent("/client/showshort")); } return(View(client)); }
public ActionResult Add(Models.Client client) { if (ModelState.IsValid) { DataAccessLayerCommon.Client Client = clientMapper.MapFromModel(client); clientRepository.Insert(Client); return(RedirectPermanent("/client/showshort")); } return(View()); }
public DataAccessLayerCommon.Client MapFromModel(Models.Client client) { DataAccessLayerCommon.Client tempClient = new DataAccessLayerCommon.Client { FirstName = client.FirstName, SecondName = client.SecondName, MiddleName = client.MiddleName, BirthDay = client.BirthDay, PassportSeriesAndNumber = client.PassportSeriesAndNumber, CardNumber = client.CardNumber }; ConcatAddress(tempClient, client); return(tempClient); }
public Models.Client MapFromEntity(DataAccessLayerCommon.Client client) { Models.Client tempClient = new Models.Client { Id = client.Id, FirstName = client.FirstName, SecondName = client.SecondName, MiddleName = client.MiddleName, BirthDay = client.BirthDay, PassportSeriesAndNumber = client.PassportSeriesAndNumber, CardNumber = client.CardNumber }; SplitAddress(client.Address, tempClient); return(tempClient); }
public ActionResult Edit(int id) { DataAccessLayerCommon.Client clientFromCommon = clientRepository.GetItem(id); Models.Client client = clientMapper.MapFromEntity(clientFromCommon); return(View(client)); }
private void ConcatAddress(DataAccessLayerCommon.Client client, Models.Client tempClient) { client.Address = tempClient.Country + "," + tempClient.City + "," + tempClient.Street; }