public int SetDeadLine(DEADLINE input) { try { db.DEADLINEs.Add(input); db.SaveChanges(); return(1); } catch (Exception ex) { return(-1); } }
public int UpdateDateLine(DEADLINE entity) { try { entity.DeadLine_ID = 2; var currentDeadLine = db.DEADLINEs.Find(entity.DeadLine_ID); currentDeadLine.DeadLine_Content = entity.DeadLine_Content; currentDeadLine.DeadLine_Start = entity.DeadLine_Start; currentDeadLine.DeadLine_End = entity.DeadLine_End; db.SaveChanges(); return(1); } catch (Exception e) { return(-1); } }
public ActionResult SetDeadLine(DateTime?start, DateTime?end, string title) { var currDeadLine = DAManager.GetDeadLine(); var res = 0; var infoDL = new DEADLINE() { DeadLine_Start = start, DeadLine_End = end, Created_Date = DateTime.Now, DeadLine_Content = title }; if (currDeadLine != null) { res = DAManager.UpdateDateLine(infoDL); } else { res = DAManager.SetDeadLine(infoDL); } return(Json(res, JsonRequestBehavior.AllowGet)); }