public AddnewMessageViewModel(INavigation nav, int Id) { Navigation = nav; Model = new inbox(); Model.PermohonanId = Id; SendCommand = new Command(SendCommandAction); }
public IActionResult Post([FromBody] inbox value) { try { var id = UserManagers.GetUserId(User); value.Tanggal = DateTime.Now; value.UserId = id; if (value.PermohonanId <= 0) { throw new SystemException("Permohonan Tidak Ditemukan"); } var service = new AppCore.Services.InboxServices(value.Id); var result = service.AddNewMessage(value); if (result) { return(Ok(value)); } else { throw new SystemException("Data Tidak Tersimpan"); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public void InboxWithEmptyListOnNullResult() { var source = new inbox(); var expected = new List <InboxDocument>(); var actual = InboxDataTransferObjectConverter.FromDataTransferObject(source); Comparator.AssertEqual(expected, actual); }
public bool AddNewMessage(inbox message) { try { using (var db = new OcphDbContext()) { if (db.Inboxs.Insert(message)) { return(true); } else { return(false); } } } catch (Exception ex) { throw new SystemException(ex.Message); } }
public void SaveInbox(inbox inbox) { InboxRepository.Save(inbox); }
internal static IEnumerable <InboxDocument> FromDataTransferObject(inbox inbox) { return(inbox.document?.Select(FromDataTransferObject) ?? new List <InboxDocument>()); }