public bool EditDocumentTypeField(int id, string code, string value, out string msg) { bool res = false; var docType = new udovika_contractType(); try { docType = GetDocumentType(id); if (docType != null) { switch (code) { case "name": docType.name = value; break; } SaveDocumentType(docType); res = true; msg = "Успешно."; } else { msg = "Ошибка. Неизвестный статус."; } } catch (Exception ex) { _debug(ex, new { }, ""); msg = "Ошибка. Тип документа не сохранен."; } return(res); }
public int SaveDocumentType(udovika_contractType item) { if (item.id == 0) { db.udovika_contractType.Add(item); } else { db.Entry(item).State = System.Data.Entity.EntityState.Modified; Save(); } return(item.id); }
public int SaveDocumentType(udovika_contractType item) { var res = 0; try { res = db.SaveDocumentType(item); } catch (Exception ex) { _debug(ex, new { item }, "item"); } return(res); }
public udovika_contractType GetDocumentType(int id) { var res = new udovika_contractType(); try { res = db.GetDocumentTypes().FirstOrDefault(x => x.id == id); } catch (Exception ex) { _debug(ex, new { }, ""); } return(res); }