public async Task <PayRollGroupView> MapToView(PayRollGroup inputObject) { Mapper mapper = new Mapper(); PayRollGroupView outObject = mapper.Map <PayRollGroupView>(inputObject); await Task.Yield(); return(outObject); }
public async Task <PayRollGroup> MapToEntity(PayRollGroupView inputObject) { Mapper mapper = new Mapper(); PayRollGroup outObject = mapper.Map <PayRollGroup>(inputObject); await Task.Yield(); return(outObject); }
public async Task <IActionResult> DeletePayRollGroup([FromBody] PayRollGroupView view) { PayRollGroupModule invMod = new PayRollGroupModule(); PayRollGroup payRollGroup = await invMod.PayRollGroup.Query().MapToEntity(view); invMod.PayRollGroup.DeletePayRollGroup(payRollGroup).Apply(); return(Ok(view)); }
public async Task <IList <PayRollGroup> > MapToEntity(IList <PayRollGroupView> inputObjects) { IList <PayRollGroup> list = new List <PayRollGroup>(); Mapper mapper = new Mapper(); foreach (var item in inputObjects) { PayRollGroup outObject = mapper.Map <PayRollGroup>(item); list.Add(outObject); } await Task.Yield(); return(list); }
public async Task <IActionResult> UpdatePayRollGroup([FromBody] PayRollGroupView view) { PayRollGroupModule invMod = new PayRollGroupModule(); PayRollGroup payRollGroup = await invMod.PayRollGroup.Query().MapToEntity(view); invMod.PayRollGroup.UpdatePayRollGroup(payRollGroup).Apply(); PayRollGroupView retView = await invMod.PayRollGroup.Query().GetViewById(payRollGroup.PayRollGroupId); return(Ok(retView)); }
public async Task <IActionResult> AddPayRollGroup([FromBody] PayRollGroupView view) { PayRollGroupModule invMod = new PayRollGroupModule(); NextNumber nnPayRollGroup = await invMod.PayRollGroup.Query().GetNextNumber(); view.PayRollGroupNumber = nnPayRollGroup.NextNumberValue; PayRollGroup payRollGroup = await invMod.PayRollGroup.Query().MapToEntity(view); invMod.PayRollGroup.AddPayRollGroup(payRollGroup).Apply(); PayRollGroupView newView = await invMod.PayRollGroup.Query().GetViewByNumber(view.PayRollGroupNumber); return(Ok(newView)); }
public async Task TestAddUpdatDeletePayRoll() { PayRollGroupModule PayRollGroupMod = new PayRollGroupModule(); PayRollGroupView view = new PayRollGroupView() { Description = "PayRollGroup Test", PayRollGroupCode = 99 }; NextNumber nnNextNumber = await PayRollGroupMod.PayRollGroup.Query().GetNextNumber(); view.PayRollGroupNumber = nnNextNumber.NextNumberValue; PayRollGroup payRollGroup = await PayRollGroupMod.PayRollGroup.Query().MapToEntity(view); PayRollGroupMod.PayRollGroup.AddPayRollGroup(payRollGroup).Apply(); PayRollGroup newPayRollGroup = await PayRollGroupMod.PayRollGroup.Query().GetEntityByNumber(view.PayRollGroupNumber); Assert.NotNull(newPayRollGroup); newPayRollGroup.Description = "PayRollGroup Test Update"; PayRollGroupMod.PayRollGroup.UpdatePayRollGroup(newPayRollGroup).Apply(); PayRollGroupView updateView = await PayRollGroupMod.PayRollGroup.Query().GetViewById(newPayRollGroup.PayRollGroupId); Assert.Same(updateView.Description, "PayRollGroup Test Update"); int code = 99; PayRollGroupView lookupByCode = await PayRollGroupMod.PayRollGroup.Query().GetViewByCode(code); Assert.NotNull(lookupByCode); PayRollGroupMod.PayRollGroup.DeletePayRollGroup(newPayRollGroup).Apply(); PayRollGroup lookupPayRollGroup = await PayRollGroupMod.PayRollGroup.Query().GetEntityById(view.PayRollGroupId); Assert.Null(lookupPayRollGroup); }
public async Task <PayRollGroupView> GetViewByCode(int code) { PayRollGroup detailItem = await _unitOfWork.payRollGroupRepository.GetEntityByCode(code); return(await MapToView(detailItem)); }
public async Task <PayRollGroupView> GetViewByNumber(long payRollGroupNumber) { PayRollGroup detailItem = await _unitOfWork.payRollGroupRepository.GetEntityByNumber(payRollGroupNumber); return(await MapToView(detailItem)); }
public IFluentPayRollGroup DeletePayRollGroup(PayRollGroup deleteObject) { unitOfWork.payRollGroupRepository.DeleteObject(deleteObject); this.processStatus = CreateProcessStatus.Delete; return(this as IFluentPayRollGroup); }
public IFluentPayRollGroup AddPayRollGroup(PayRollGroup newObject) { unitOfWork.payRollGroupRepository.AddObject(newObject); this.processStatus = CreateProcessStatus.Insert; return(this as IFluentPayRollGroup); }