public bool AddOrUpdateStaticSpecification(StaticSpecification spec) { bool result = false; try { dbService.Run(db => { var specDB = db.GetRepository <StaticSpecification>().TryOne(spec.id); if (specDB == null) { db.GetRepository <StaticSpecification>().Add(spec); } else { specDB.name = spec.name; db.GetRepository <StaticSpecification>().Update(specDB); } }); result = true; } catch (Exception err) { result = false; logger.Error(err.Message); } return(result); }
public ActionResult AddOrUpdateStaticSpecification(StaticSpecification spec) { var message = string.Empty; try { if (ModelState.IsValid) { if (dataService.AddOrUpdateStaticSpecification(spec)) { return(Content("Спецификация сохранена", "text/html")); } } } catch (Exception err) { message = err.Message; } return(Content("Спецификация НЕ сохранена " + message, "text/html")); }
public bool AddOrUpdateStaticSpecification(StaticSpecification spec) { bool result = false; try { dbService.Run(db => { var specDB = db.GetRepository<StaticSpecification>().TryOne(spec.id); if (specDB == null) { db.GetRepository<StaticSpecification>().Add(spec); } else { specDB.name = spec.name; db.GetRepository<StaticSpecification>().Update(specDB); } }); result = true; } catch (Exception err) { result = false; logger.Error(err.Message); } return result; }
public ActionResult AddOrUpdateStaticSpecification(StaticSpecification spec) { var message = string.Empty; try { if (ModelState.IsValid) { if (dataService.AddOrUpdateStaticSpecification(spec)) { return Content("Спецификация сохранена", "text/html"); } } } catch (Exception err) { message = err.Message; } return Content("Спецификация НЕ сохранена " + message, "text/html"); }