private DeliveryReportMessageTypeDTO Create(DeliveryReportMessageTypeViewModel viewModel) { try { log.Debug(DeliveryReportMessageTypeViewModel.FormatDeliveryReportMessageTypeViewModel(viewModel)); DeliveryReportMessageTypeDTO deliveryReportMessageType = new DeliveryReportMessageTypeDTO(); // copy values viewModel.UpdateDTO(deliveryReportMessageType, null); //RequestContext.Principal.Identity.GetUserId()); // audit deliveryReportMessageType.CreateBy = null; //RequestContext.Principal.Identity.GetUserId(); deliveryReportMessageType.CreateOn = DateTime.UtcNow; // add log.Debug("_deliveryReportMessageTypeService.AddDeliveryReportMessageType - " + DeliveryReportMessageTypeDTO.FormatDeliveryReportMessageTypeDTO(deliveryReportMessageType)); int id = _deliveryReportMessageTypeService.AddDeliveryReportMessageType(deliveryReportMessageType); deliveryReportMessageType.DeliveryReportMessageTypeId = id; log.Debug("result: 'success', id: " + id); return(deliveryReportMessageType); } catch (Exception e) { // error log.Error(e.ToString()); throw; } }
private DeliveryReportMessageTypeDTO Update(DeliveryReportMessageTypeViewModel viewModel) { try { log.Debug(DeliveryReportMessageTypeViewModel.FormatDeliveryReportMessageTypeViewModel(viewModel)); // get log.Debug("_deliveryReportMessageTypeService.GetDeliveryReportMessageType - deliveryReportMessageTypeId: " + viewModel.DeliveryReportMessageTypeId + " "); var existingDeliveryReportMessageType = _deliveryReportMessageTypeService.GetDeliveryReportMessageType(viewModel.DeliveryReportMessageTypeId); log.Debug("_deliveryReportMessageTypeService.GetDeliveryReportMessageType - " + DeliveryReportMessageTypeDTO.FormatDeliveryReportMessageTypeDTO(existingDeliveryReportMessageType)); if (existingDeliveryReportMessageType != null) { // copy values viewModel.UpdateDTO(existingDeliveryReportMessageType, null); //RequestContext.Principal.Identity.GetUserId()); // update log.Debug("_deliveryReportMessageTypeService.UpdateDeliveryReportMessageType - " + DeliveryReportMessageTypeDTO.FormatDeliveryReportMessageTypeDTO(existingDeliveryReportMessageType)); _deliveryReportMessageTypeService.UpdateDeliveryReportMessageType(existingDeliveryReportMessageType); log.Debug("result: 'success'"); } else { log.Error("existingDeliveryReportMessageType: null, DeliveryReportMessageTypeId: " + viewModel.DeliveryReportMessageTypeId); } return(existingDeliveryReportMessageType); } catch (Exception e) { // error log.Error(e.ToString()); throw; } }