public ActionResult Edit(LearningFlow flow) { this.ViewBag.FlowTypes = new LearningFlow().FlowType.ToSelectList(); if (ModelState.IsValid) { var lastFlow = LearningFlowService.Get(flow.ID); lastFlow.Name = flow.Name; var state = LearningFlowService.Update(lastFlow); if (state) { Notification.Notify(NotificationType.Success, "Edit Successfull"); } else { Notification.Notify(NotificationType.Fail, "Edit Failed"); } return(this.RedirectToAction("List")); } Logger.Warn("Flow model not valid!. Propably client validation didn't worked out."); Notification.Notify(NotificationType.Fail, "Validation Failed!"); return(this.View(flow)); }
public ActionResult Clear(LearningFlow flow) { var state = LearningFlowService.Update(flow); if (state) { return(this.Json(Is.Success.Empty)); } else { return(this.Json(Is.Fail.Message("Clear Failed"))); } }
public ActionResult EditItems(LearningFlow flow) { if (ModelState.IsValid) { var state = LearningFlowService.Update(flow); if (state) { Notification.Notify(NotificationType.Success, "Edit Successfull"); } else { Notification.Notify(NotificationType.Fail, "Edit Failed"); } return(this.View(flow)); } Logger.Warn("Flow model not valid!. Propably client validation didn't worked out."); Notification.Notify(NotificationType.Fail, "Validation Failed!"); return(this.View(flow)); }
public ActionResult AddTask(LearningTask task, int flowId) { if (ModelState.IsValid) { var flow = LearningFlowService.Get(flowId); if (flow != null) { task.Name = Server.HtmlEncode(task.Name); flow.Tasks.Add(task); LearningFlowService.Update(flow); return(this.Json(Is.Success.Message(task.ID.ToString()))); } Logger.Warn("User tried to add task to non existing flow"); return(this.Json(Is.Fail.Message("Flow doesn't exist"))); } Logger.Warn("Add Task - Validation Fail"); return(this.Json(Is.Fail.Message("Valdiation Failed"))); }