public JsonResult SaveOrUpdate(LinesPlanApiModel model, string pass, bool doAppendPlan) { if (pass != HARDCODED_PASS) { return(MakeBadRequest(DEBS.Translate("Message.PasswordInvalid"))); } using (var l = new tblLinesPlanLogic()) { if (doAppendPlan) { var tlp = l.GetFirstByLine(model.LineId) ?? new tblLinesPlan { LineId = model.LineId }; model.UpdateDBModelShallow(tlp); l.Save(tlp); } else { var tlp = l.GetFirstByLine(model.LineId); if (tlp != null) { l.Remove(tlp); } } } return(MakeSuccesResult()); }
public JsonResult Edit(LinesPlanApiModel model) { using (var l = new tblLinesPlanLogic()) { var item = l.Get(model.Id); model.UpdateDBModelShallow(item); l.Save(item); } return(MakeSuccesResult(true)); //return MakeBadRequest(); }