public ActionResult AddProgressAjax(GoalProgress model) { if (ModelState.IsValid == true) { try { GoalProgress Goalprogress = IBOVirtualAPI.GetProgress(model.goalId.ToString()); if (model.progress == 100) { Goal Goal = IBOVirtualAPI.Get <Goal>(model.goalId.ToString()); Goal.completed = true; string result = IBOVirtualAPI.Update <Goal>(Goal.goalId.ToString(), Goal); } if (Goalprogress == null) { bool result = IBOVirtualAPI.CreateProgress(model); } else { model.progressId = Goalprogress.progressId; string result = IBOVirtualAPI.UpdateProgress(model.progressId.ToString(), model); } return(Json(model)); } catch { return(Json(new { success = false })); } } else { return(Json(new { success = false })); } }
public decimal GetProgress(string id) { GoalProgress Goalprogress = IBOVirtualAPI.GetProgress(id); try { return(Goalprogress.progress); } catch { return(0); } }
public ActionResult EditProgress(string id) { GoalProgress Goalprogress = IBOVirtualAPI.GetProgress(id); return(PartialView(Goalprogress)); }