public string select(int id, int ac_id, string type) { Context.ERPDynamicConfig eRPDynamicConfig = RepoERPConfig.FindByIdAndType(id, type); ac_mstr ac = Repoac_mstr.FindByPk(ac_id); return(new JavaScriptSerializer().Serialize(new { id = id, ac_id = ac.id, ac_code = ac.ac_code, ac_name = ac.ac_name })); }
public void saveDynamic(int id, int ac_id, string type) { if (type == "SPBU") { Context.ERPDynamicConfig model = new Context.ERPDynamicConfig(); model.ac_id = ac_id; model.lookup_code_id = id; context.ERPDynamicConfig.Add(model); context.SaveChanges(); Context.LookupCode lc = context.LookupCode.Where(d => d.Id == id).FirstOrDefault(); lc.ac_id = ac_id; context.LookupCode.Attach(lc); var entry = context.Entry(lc); entry.State = EntityState.Modified; context.SaveChanges(); } else if (type == "Pool") { Context.ERPDynamicConfig model = new Context.ERPDynamicConfig(); model.ac_id = ac_id; model.pool_id = id; context.ERPDynamicConfig.Add(model); context.SaveChanges(); Context.MasterPool lc = context.MasterPool.Where(d => d.Id == id).FirstOrDefault(); lc.IdCreditCash = ac_id; context.MasterPool.Attach(lc); var entry = context.Entry(lc); entry.State = EntityState.Modified; context.SaveChanges(); } }
public void save(int id, int ac_id, string type) { Context.ERPDynamicConfig eRPDynamicConfig = RepoERPConfig.FindByIdAndType(id, type); RepoERPConfig.saveDynamic(id, ac_id, type); }