示例#1
0
 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());
 }
示例#2
0
 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();
 }