public Withholding GetSingle(string id, long companyId) { Withholding withholding = this.GetAll(companyId) .FirstOrDefault(x => x.Id == Convert.ToInt32(id)); return(withholding); }
public string Update(Withholding entity) { var originalEntity = this.Context.Withholdings.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return(entity.Id.ToString()); }
public async Task <User> GetUser(Withholding withholding, [ScopedService] QueryDbContext context, UsersByIdBatchDataLoader usersDataLoader, CancellationToken token) { var userId = await context.Wallets .Where(w => w.Id == withholding.CreditedWalletId) .Select(w => w.UserId) .SingleAsync(token); return(await usersDataLoader.LoadAsync(userId, token)); }
public string Update(Withholding entity) { if (entity.IsValid()) { return(this.repository.Update(entity)); } else { return("Entity is not in valid state"); } }
public WithholdingModel(Withholding entity) { this.Id = entity.Id; this.SOBId = entity.SOBId; this.CodeCombinitionId = entity.CodeCombinitionId; this.DateFrom = entity.DateFrom; this.DateTo = entity.DateTo; this.Description = entity.Description; this.Rate = entity.Rate; this.VendorId = entity.VendorId; this.VendorSiteId = entity.VendorSiteId; this.WithholdingCode = entity.Code; this.CompanyId = entity.CompanyId; this.CreateBy = entity.CreateBy; this.CreateDate = entity.CreateDate; this.UpdateBy = entity.UpdateBy; this.UpdateDate = entity.UpdateDate; }
private static Withholding getEntityByModel(WithholdingModel model) { if (model == null) { return(null); } Withholding entity = new Withholding(); if (model.Id == 0) { entity.CreateBy = AuthenticationHelper.UserId; entity.CreateDate = DateTime.Now; entity.CompanyId = AuthenticationHelper.CompanyId.Value; } else { entity.CreateBy = model.CreateBy; entity.CreateDate = model.CreateDate; entity.CompanyId = model.CompanyId; } entity.Code = model.WithholdingCode; entity.VendorSiteId = model.VendorSiteId; entity.VendorId = model.VendorId; entity.SOBId = model.SOBId; entity.Rate = model.Rate; entity.Description = model.Description; entity.DateTo = model.DateTo; entity.DateFrom = model.DateFrom; entity.CodeCombinitionId = model.CodeCombinitionId; entity.Id = model.Id; entity.UpdateBy = AuthenticationHelper.UserId; entity.UpdateDate = DateTime.Now; return(entity); }
public string Insert(Withholding entity) { this.Context.Withholdings.Add(entity); this.Commit(); return(entity.Id.ToString()); }