protected override BaseModel Execute(BaseModel dat) { OnixErpDbContext ctx = (OnixErpDbContext)context; CompanyProfile m = (CompanyProfile)dat; if ((m.CompanyPrefix != null) && (m.CompanyPrefix.MasterId != null)) { int?id = m.CompanyPrefix.MasterId; var o = ctx.Masters .Where(s => s.MasterId == id) .FirstOrDefault(); m.CompanyPrefix = o; } if (ConvertUtils.NullableToInt(m.CompanyProfileId, 0) <= 0) { m.CompanyProfileId = null; ctx.CompanyProfiles.Add(m); } else { ctx.CompanyProfiles.Update(m); } ctx.SaveChanges(); return(m); }
protected override BaseModel Execute(BaseModel dat) { OnixErpDbContext ctx = (OnixErpDbContext)context; Master m = (Master)dat; ctx.Masters.Remove(m); ctx.SaveChanges(); return(m); }
protected override BaseModel Execute(BaseModel dat) { OnixErpDbContext ctx = (OnixErpDbContext)context; CompanyProfile m = (CompanyProfile)dat; ctx.CompanyProfiles.Remove(m); ctx.SaveChanges(); return(m); }
protected override BaseModel Execute(BaseModel dat) { OnixErpDbContext ctx = (OnixErpDbContext)context; Master m = (Master)dat; if (ConvertUtils.NullableToInt(m.MasterId, 0) <= 0) { m.MasterId = null; ctx.Masters.Add(m); } else { ctx.Masters.Update(m); } ctx.SaveChanges(); return(m); }