public DTO.FactoryMng.Factory DB2DTO_Material(FactoryMng_Factory_View dbItem) { DTO.FactoryMng.Factory dtoItem = AutoMapper.Mapper.Map <FactoryMng_Factory_View, DTO.FactoryMng.Factory>(dbItem); dtoItem.ConcurrencyFlag_String = Convert.ToBase64String(dtoItem.ConcurrencyFlag); return(dtoItem); }
public IHttpActionResult Update(int id, DTO.FactoryMng.Factory 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.FactoryMng.Factory>(dtoItem, out notification)) { return(Ok(new Library.DTO.ReturnData <DTO.FactoryMng.Factory>() { Data = dtoItem, Message = notification })); } // continue processing BLL.FactoryMng bll = new BLL.FactoryMng(); 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.FactoryMng.Factory>() { Data = dtoItem, Message = notification })); }
public void DTO2BD_Material(DTO.FactoryMng.Factory dtoItem, ref Factory dbItem) { AutoMapper.Mapper.Map <DTO.FactoryMng.Factory, Factory>(dtoItem, dbItem); dbItem.UpdatedDate = DateTime.Now; }