public void Check(IEnumerable <TypeModel> typeModels) { var add = new List <TypeEntity>(); var del = new List <string>(); var modify = new List <TypeEntity>(); foreach (var model in typeModels) { if (model.IsDelete) { del.Add(model.ID); continue; } if (model.IsModify) { modify.Add(new TypeEntity() { ID = Convert.ToInt32(model.ID), IOFlag = model.IOFlag, Name = model.Name }); continue; } if (string.IsNullOrWhiteSpace(model.ID)) { add.Add(new TypeEntity() { IOFlag = model.IOFlag, Name = model.Name }); continue; } } dal.Delete(del); dal.Update(modify); dal.Insert(add); }
public bool Delete(TypeBO type) { return(TypeDAL.Delete(type)); }