public async Task TestAddUpdatDelete() { BudgetNoteModule BudgetNoteMod = new BudgetNoteModule(); Budget budget = await BudgetNoteMod.Budget.Query().GetEntityById(2); BudgetNoteView view = new BudgetNoteView() { BudgetId = budget.BudgetId, Note = "Test Note" }; NextNumber nnNextNumber = await BudgetNoteMod.BudgetNote.Query().GetNextNumber(); view.BudgetNoteNumber = nnNextNumber.NextNumberValue; BudgetNote budgetNote = await BudgetNoteMod.BudgetNote.Query().MapToEntity(view); BudgetNoteMod.BudgetNote.AddBudgetNote(budgetNote).Apply(); BudgetNote newBudgetNote = await BudgetNoteMod.BudgetNote.Query().GetEntityByNumber(view.BudgetNoteNumber); Assert.NotNull(newBudgetNote); newBudgetNote.Note = "Test Note Update"; BudgetNoteMod.BudgetNote.UpdateBudgetNote(newBudgetNote).Apply(); BudgetNoteView updateView = await BudgetNoteMod.BudgetNote.Query().GetViewById(newBudgetNote.BudgetNoteId); Assert.Same(updateView.Note, "Test Note Update"); BudgetNoteMod.BudgetNote.DeleteBudgetNote(newBudgetNote).Apply(); BudgetNote lookupBudgetNote = await BudgetNoteMod.BudgetNote.Query().GetEntityById(view.BudgetNoteId); Assert.Null(lookupBudgetNote); }
public async Task <IActionResult> DeleteBudgetNote([FromBody] BudgetNoteView view) { BudgetNoteModule invMod = new BudgetNoteModule(); BudgetNote budgetNote = await invMod.BudgetNote.Query().MapToEntity(view); invMod.BudgetNote.DeleteBudgetNote(budgetNote).Apply(); return(Ok(view)); }
public async Task <IActionResult> UpdateBudgetNote([FromBody] BudgetNoteView view) { BudgetNoteModule invMod = new BudgetNoteModule(); BudgetNote budgetNote = await invMod.BudgetNote.Query().MapToEntity(view); invMod.BudgetNote.UpdateBudgetNote(budgetNote).Apply(); BudgetNoteView retView = await invMod.BudgetNote.Query().GetViewById(budgetNote.BudgetNoteId); return(Ok(retView)); }
public async Task <IActionResult> AddBudgetNote([FromBody] BudgetNoteView view) { BudgetNoteModule invMod = new BudgetNoteModule(); NextNumber nnBudgetNote = await invMod.BudgetNote.Query().GetNextNumber(); view.BudgetNoteNumber = nnBudgetNote.NextNumberValue; BudgetNote budgetNote = await invMod.BudgetNote.Query().MapToEntity(view); invMod.BudgetNote.AddBudgetNote(budgetNote).Apply(); BudgetNoteView newView = await invMod.BudgetNote.Query().GetViewByNumber(view.BudgetNoteNumber); return(Ok(newView)); }
public IFluentBudgetNote DeleteBudgetNote(BudgetNote deleteObject) { unitOfWork.budgetNoteRepository.DeleteObject(deleteObject); this.processStatus = CreateProcessStatus.Delete; return(this as IFluentBudgetNote); }
public IFluentBudgetNote UpdateBudgetNote(BudgetNote updateObject) { unitOfWork.budgetNoteRepository.UpdateObject(updateObject); this.processStatus = CreateProcessStatus.Update; return(this as IFluentBudgetNote); }
public IFluentBudgetNote AddBudgetNote(BudgetNote newObject) { unitOfWork.budgetNoteRepository.AddObject(newObject); this.processStatus = CreateProcessStatus.Insert; return(this as IFluentBudgetNote); }