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 EditItems(int id) { var flow = LearningFlowService.Get(id); if (flow != null) { return(this.View(flow)); } else { return(this.View("Error", ErrorType.NotFound)); } }
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 Edit(int id) { this.ViewBag.FlowTypes = new LearningFlow().FlowType.ToSelectList(); var flow = LearningFlowService.Get(id); if (flow != null) { return(this.View(flow)); } else { return(this.View("Error", ErrorType.NotFound)); } }
public ActionResult Remove(int id) { var flow = LearningFlowService.Get(id); if (flow != null) { return(this.View(flow)); } else { Logger.Warn("Unable to remove flow beacuse it wasn't found in DB. Possible error. Beacuse flow is visible in view but not visible in DB."); return(this.View("Error", ErrorType.NotFound)); } }
public ActionResult RemoveTask(int taskId, int flowId) { var flow = LearningFlowService.Get(flowId); if (flow != null) { if (flow.Tasks.Any(t => t.ID == taskId)) { LearningFlowService.RemoveTask(flow, taskId); return(this.Json(Is.Success.Empty)); } Logger.Warn("User tried to remove non exisitng task"); return(this.Json(Is.Fail.Message("Task doesn't exist"))); } Logger.Warn("User tried to remove task from non existing flow"); return(this.Json(Is.Fail.Message("Flow doesn't exist"))); }
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"))); }
public ActionResult Add(LearningFlow newFlow) { if (ModelState.IsValid) { newFlow.Tasks = new List <LearningTask>(); var id = LearningFlowService.Add(newFlow); if (id > 0) { Notification.Notify(NotificationType.Success, "Adding new flow successfull"); } else { Notification.Notify(NotificationType.Fail, "Adding new flow failed"); } return(this.RedirectToAction("EditItems", new { id })); } Logger.Warn("Flow model not valid!. Propably client validation didn't worked out."); Notification.Notify(NotificationType.Fail, "Validation Failed!"); return(this.View()); }