public void DTO2DB_DocumentMonitoring(DTO.DocumentMonitoringMng.DocumentMonitoring dtoItem, ref DocumentMonitoring dbItem) { AutoMapper.Mapper.Map <DTO.DocumentMonitoringMng.DocumentMonitoring, DocumentMonitoring>(dtoItem, dbItem); if (dtoItem.DocumentMonitoringID > 0) { dbItem.UpdatedDate = DateTime.Now; dbItem.UpdatedBy = dtoItem.UpdatedBy; } else { dbItem.CreatedDate = DateTime.Now; dbItem.CreatedBy = dtoItem.UpdatedBy; } dbItem.VNReceivedDate = dtoItem.VNReceivedDate.ConvertStringToDateTime(); dbItem.SendToEUDate = dtoItem.SendToEUDate.ConvertStringToDateTime(); }
public IHttpActionResult Get(int id) { // authentication Module.Framework.BLL fwBll = new Module.Framework.BLL(); if (!fwBll.CanPerformAction(ControllerContext.GetAuthUserId(), moduleCode, Library.DTO.ModuleAction.CanRead)) { return(InternalServerError(new Exception(Properties.Resources.NOT_AUTHORIZED))); } BLL.DocumentMonitoringMng bll = new BLL.DocumentMonitoringMng(); Library.DTO.Notification notification; DTO.DocumentMonitoringMng.DocumentMonitoring data = bll.GetData(id, ControllerContext.GetAuthUserId(), out notification); return(Ok(new Library.DTO.ReturnData <DTO.DocumentMonitoringMng.DocumentMonitoring>() { Data = data, Message = notification })); }
public IHttpActionResult Update(int id, DTO.DocumentMonitoringMng.DocumentMonitoring 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.DocumentMonitoringMng.DocumentMonitoring>(dtoItem, out notification)) { return(Ok(new Library.DTO.ReturnData <DTO.DocumentMonitoringMng.DocumentMonitoring>() { Data = dtoItem, Message = notification })); } // continue processing BLL.DocumentMonitoringMng bll = new BLL.DocumentMonitoringMng(); bll.UpdateData(id, ref dtoItem, ControllerContext.GetAuthUserId(), out notification); return(Ok(new Library.DTO.ReturnData <DTO.DocumentMonitoringMng.DocumentMonitoring>() { Data = dtoItem, Message = notification })); }
public DTO.DocumentMonitoringMng.DocumentMonitoring DB2DTO_DocumentMonitoring(DocumentMonitoringMng_DocumentMonitoring_View dbItem) { DTO.DocumentMonitoringMng.DocumentMonitoring dtoItem = AutoMapper.Mapper.Map <DocumentMonitoringMng_DocumentMonitoring_View, DTO.DocumentMonitoringMng.DocumentMonitoring>(dbItem); return(dtoItem); }