public string Update(PayableInvoice entity) { if (entity.IsValid()) return this.repository.Update(entity); else return "Entity is not in valid state"; }
private static PayableInvoice getEntityByModel(PayableInvoiceModel model) { if (model == null) return null; PayableInvoice entity = new PayableInvoice(); 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.Amount = model.Amount; entity.Id = model.Id; entity.InvoiceDate = model.InvoiceDate; entity.InvoiceNo = model.InvoiceNo; entity.InvoiceTypeId = model.InvoiceTypeId; entity.PeriodId = model.PeriodId; entity.Remarks = model.Remarks; entity.SOBId = model.SOBId; entity.Status = model.Status; entity.UpdateBy = model.UpdateBy; entity.UpdateDate = model.UpdateDate; entity.VendorId = model.VendorId; entity.VendorSiteId = model.VendorSiteId; entity.WHTaxId = model.WHTaxId; return entity; }
public string Update(PayableInvoice entity) { PayableInvoice originalEntity = this.Context.PayableInvoices.Find(entity.Id); this.Context.Entry(originalEntity).CurrentValues.SetValues(entity); this.Context.Entry(originalEntity).State = EntityState.Modified; this.Commit(); return entity.Id.ToString(); }
public PayableInvoiceModel(PayableInvoice entity) { this.Amount = entity.Amount; this.CompanyId = AuthenticationHelper.CompanyId.Value; // entity.CompanyId; this.CreateBy = entity.CreateBy; this.CreateDate = entity.CreateDate; this.Id = entity.Id; this.InvoiceDate = entity.InvoiceDate; this.InvoiceNo = entity.InvoiceNo; this.InvoiceTypeId = entity.InvoiceTypeId; this.PeriodId = entity.PeriodId; this.Remarks = entity.Remarks; this.SOBId = entity.SOBId; this.Status = entity.Status; this.UpdateBy = entity.UpdateBy; this.UpdateDate = entity.UpdateDate; this.VendorId = entity.VendorId; this.VendorSiteId = entity.VendorSiteId; this.WHTaxId = entity.WHTaxId; }
public string Insert(PayableInvoice entity) { this.Context.PayableInvoices.Add(entity); this.Commit(); return entity.Id.ToString(); }