public ActionResult CusAuditIndex(System.Int32 id, string tag) { T_CusQYModels model = new T_CusQYModels(); model.DataModel = new T_CusQY(); T_CusQYZZ zzmodel = new T_CusQYZZ(); if (id != 0) { model.DataModel = T_CusQYDomain.GetInstance().GetModelById(id); model.CusQYZZList = T_CusQYZZDomain.GetInstance().GetAllT_BJD(zzmodel); if (model.CusQYZZList.Count > 0) { model.CusQYZZList = model.CusQYZZList.Where(p => p.QYID == id).ToList(); } } model.Tag = tag; return(View("~/Views/T_CusQY/CusAuditIndex.cshtml", model)); }
public void OperQyzz(int qyid, string qyzzFiles) { if (string.IsNullOrEmpty(qyzzFiles) || qyid == 0) { return; } string[] files = qyzzFiles.Split(';'); List <T_CusQYZZ> addFiles = new List <T_CusQYZZ>(); using (MedicalApparatusManageEntities hContext1 = new MedicalApparatusManageEntities()) { try { foreach (var item in files) { if (!string.IsNullOrEmpty(item)) { T_CusQYZZ qyzz = new T_CusQYZZ() { ZZFJ = item, QYID = qyid }; addFiles.Add(qyzz); } } //先删除后增加 DbSet <T_CusQYZZ> db = hContext1.Set <T_CusQYZZ>(); var deleteFiles = db.Where(p => p.QYID == qyid); db.RemoveRange(deleteFiles); db.AddRange(addFiles); hContext1.SaveChanges(); } catch (Exception ex) { } } }