public async Task TestAddUpdatDelete() { PayRollEarningsModule PayRollEarningsMod = new PayRollEarningsModule(); PayRollEarningsView view = new PayRollEarningsView() { EarningCode = 1, Description = "Earnings", EarningType = "E" }; NextNumber nnNextNumber = await PayRollEarningsMod.PayRollEarnings.Query().GetNextNumber(); view.PayRollEarningsNumber = nnNextNumber.NextNumberValue; PayRollEarnings payRollEarnings = await PayRollEarningsMod.PayRollEarnings.Query().MapToEntity(view); PayRollEarningsMod.PayRollEarnings.AddPayRollEarnings(payRollEarnings).Apply(); PayRollEarnings newPayRollEarnings = await PayRollEarningsMod.PayRollEarnings.Query().GetEntityByNumber(view.PayRollEarningsNumber); Assert.NotNull(newPayRollEarnings); newPayRollEarnings.Description = "Earnings Update"; PayRollEarningsMod.PayRollEarnings.UpdatePayRollEarnings(newPayRollEarnings).Apply(); PayRollEarningsView updateView = await PayRollEarningsMod.PayRollEarnings.Query().GetViewById(newPayRollEarnings.PayRollEarningsId); Assert.Same(updateView.Description, "Earnings Update"); PayRollEarningsMod.PayRollEarnings.DeletePayRollEarnings(newPayRollEarnings).Apply(); PayRollEarnings lookupPayRollEarnings = await PayRollEarningsMod.PayRollEarnings.Query().GetEntityById(view.PayRollEarningsId); Assert.Null(lookupPayRollEarnings); }
public async Task <PayRollEarningsView> MapToView(PayRollEarnings inputObject) { Mapper mapper = new Mapper(); PayRollEarningsView outObject = mapper.Map <PayRollEarningsView>(inputObject); await Task.Yield(); return(outObject); }
public async Task <IActionResult> DeletePayRollEarnings([FromBody] PayRollEarningsView view) { PayRollEarningsModule invMod = new PayRollEarningsModule(); PayRollEarnings payRollEarnings = await invMod.PayRollEarnings.Query().MapToEntity(view); invMod.PayRollEarnings.DeletePayRollEarnings(payRollEarnings).Apply(); return(Ok(view)); }
public async Task <IList <PayRollEarnings> > MapToEntity(IList <PayRollEarningsView> inputObjects) { IList <PayRollEarnings> list = new List <PayRollEarnings>(); Mapper mapper = new Mapper(); foreach (var item in inputObjects) { PayRollEarnings outObject = mapper.Map <PayRollEarnings>(item); list.Add(outObject); } await Task.Yield(); return(list); }
public async Task <IActionResult> UpdatePayRollEarnings([FromBody] PayRollEarningsView view) { PayRollEarningsModule invMod = new PayRollEarningsModule(); PayRollEarnings payRollEarnings = await invMod.PayRollEarnings.Query().MapToEntity(view); invMod.PayRollEarnings.UpdatePayRollEarnings(payRollEarnings).Apply(); PayRollEarningsView retView = await invMod.PayRollEarnings.Query().GetViewById(payRollEarnings.PayRollEarningsId); return(Ok(retView)); }
public async Task <IActionResult> AddPayRollEarnings([FromBody] PayRollEarningsView view) { PayRollEarningsModule invMod = new PayRollEarningsModule(); NextNumber nnPayRollEarnings = await invMod.PayRollEarnings.Query().GetNextNumber(); view.PayRollEarningsNumber = nnPayRollEarnings.NextNumberValue; PayRollEarnings payRollEarnings = await invMod.PayRollEarnings.Query().MapToEntity(view); invMod.PayRollEarnings.AddPayRollEarnings(payRollEarnings).Apply(); PayRollEarningsView newView = await invMod.PayRollEarnings.Query().GetViewByNumber(view.PayRollEarningsNumber); return(Ok(newView)); }
public async Task <PayRollEarningsView> GetViewByNumber(long payRollEarningsNumber) { PayRollEarnings detailItem = await _unitOfWork.payRollEarningsRepository.GetEntityByNumber(payRollEarningsNumber); return(await MapToView(detailItem)); }
public IFluentPayRollEarnings DeletePayRollEarnings(PayRollEarnings deleteObject) { unitOfWork.payRollEarningsRepository.DeleteObject(deleteObject); this.processStatus = CreateProcessStatus.Delete; return(this as IFluentPayRollEarnings); }
public IFluentPayRollEarnings AddPayRollEarnings(PayRollEarnings newObject) { unitOfWork.payRollEarningsRepository.AddObject(newObject); this.processStatus = CreateProcessStatus.Insert; return(this as IFluentPayRollEarnings); }