public bool SaveOrderNotes(OrderNotesEntity noteData) { var config = new MapperConfiguration(cfg => cfg.CreateMap <OrderNotesEntity, OrderNotes>()); var mapper = config.CreateMapper(); OrderNotes savedNote = mapper.Map <OrderNotesEntity, OrderNotes>(noteData); using (var scope = new TransactionScope()) { if (noteData.NoteId <= 0) { savedNote.Suffix = "OT"; savedNote.Priority = false; savedNote.ClientViewable = true; savedNote.NoteSource = "I"; savedNote.ItemNo = 1; _unitOfWork.OrderNotesRepository.Insert(savedNote); } else { _unitOfWork.OrderNotesRepository.Update(savedNote); } _unitOfWork.Save(); scope.Complete(); return(true); } }
public HttpResponseMessage Post([FromBody] OrderNotesEntity notesEntity) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Please provide all the required fields.")); } notesEntity.LastModDate = DateTime.Now; notesEntity.Inactive = false; _orderNotesServices.CpAddOrderNoteInEmailQueue(notesEntity.OrderNo, notesEntity.Note, notesEntity.NoteType); return(Request.CreateResponse(HttpStatusCode.OK, _orderNotesServices.SaveOrderNotes(notesEntity))); }