//public List<DTO.ClientCountryMng.ClientCountrySearchResult> DB2DTO_ClientSitySearchCountryList(List<DTO.ClientCountryMng.ClientCountrySearchResult> dbItems) //{ //return AutoMapper.Mapper.Map<List<CL ClientCountryMng_ClientCountrySearchResult>, List(DTO.ClientCountryMng.ClientCountrySearchResult>>(dbItems); //} public DTO.ClientCityMng.ClientCity DB2DTO_ClientCity(ClientCityMng_ClientCity_View dbItem) { DTO.ClientCityMng.ClientCity dtoItem = AutoMapper.Mapper.Map <ClientCityMng_ClientCity_View, DTO.ClientCityMng.ClientCity>(dbItem); if (dtoItem == null) { return(dtoItem); } if (dtoItem.CreatedDate.HasValue) { dtoItem.CreatedDateFormated = dtoItem.CreatedDate.Value.ToString("dd/MM/yyyy"); } if (dtoItem.UpdatedDate.HasValue) { dtoItem.UpdatedDateFormated = dtoItem.UpdatedDate.Value.ToString("dd/MM/yyyy"); } return(dtoItem); }
public IHttpActionResult Update(int id, DTO.ClientCityMng.ClientCity dtoItem) { Library.DTO.Notification notification; // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (id > 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanUpdate)) { // edit case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } else if (id == 0 && !fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanCreate)) { // create new case return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } // validation if (!Helper.CommonHelper.ValidateDTO <DTO.ClientCityMng.ClientCity>(dtoItem, out notification)) { return(Ok(new Library.DTO.ReturnData <DTO.ClientCityMng.ClientCity>() { Data = dtoItem, Message = notification })); } // continue processing BLL.ClientCityMng bll = new BLL.ClientCityMng(); bll.UpdateData(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification); if (notification.Type == Library.DTO.NotificationType.Error) { return(InternalServerError(new Exception(notification.Message))); } return(Ok(new Library.DTO.ReturnData <DTO.ClientCityMng.ClientCity>() { Data = dtoItem, Message = notification })); }
public void DTO2BD_ClientCity(DTO.ClientCityMng.ClientCity dtoItem, ref ClientCity dbItem) { AutoMapper.Mapper.Map <DTO.ClientCityMng.ClientCity, ClientCity>(dtoItem, dbItem); }