public static void InsertList(List <template_img> _lists) { foreach (template_img tmp in _lists) { template_img existing = _repository.Find(x => x.id == tmp.id).FirstOrDefault(); //if (existing == null) //{ _repository.Add(tmp); //} //else //{ // _repository.Edit(existing, tmp); //} //switch (tmp.RowState) //{ // case CommandNameEnum.Add: // _repository.Add(tmp); // break; // case CommandNameEnum.Edit: // template_img existing = _repository.Find(x => x.id == tmp.id).FirstOrDefault(); // _repository.Edit(existing, tmp); // break; //} } }
public void Update() { template_img existing = _repository.Find(x => x.id == this.id).FirstOrDefault(); _repository.Edit(existing, this); }