public ActionResult Create(Logica.Models.BindingModels.TasksCreateBindingModel model) { if (ModelState.IsValid) { Logica.BL.Tasks tasks = new Logica.BL.Tasks(); tasks.CreateTasks(model.Title, model.Details, model.ExpirationDate, model.IsCompleted, model.Effort, model.RemainingWork, model.StateId, model.ActivityId, model.PriorityId, model.ProjectId); return(RedirectToAction("Index", new { projectId = model.ProjectId })); } Logica.BL.States states = new Logica.BL.States(); ViewBag.States = states.GetStates(); Logica.BL.Activities activities = new Logica.BL.Activities(); ViewBag.Activities = activities.GetActivities(); Logica.BL.Priorities priorities = new Logica.BL.Priorities(); ViewBag.Priorities = priorities.GetPriorities(); return(View(model)); }
public IActionResult Create(int?projectId) { var taskBindingModel = new Logica.Models.BindingModel.TasksCreateBindingModel { ProjectId = projectId }; Logica.BL.Activities activities = new Logica.BL.Activities(); ViewBag.Activities = activities.GetActivities(); Logica.BL.Priorities priorities = new Logica.BL.Priorities(); ViewBag.Priorities = priorities.GetPriorities(); Logica.BL.States states = new Logica.BL.States(); ViewBag.States = states.GetStates(); return(View(taskBindingModel)); }
public ActionResult Details(int?id) { try { Logica.BL.Tasks tasks = new Logica.BL.Tasks(); var listTasks = tasks.GetTasks(null, id); var taskViewModel = listTasks.Select(x => new Logica.Models.ViewModels.TasksDetailsViewModel { Id = x.Id, Title = x.Title, Details = x.Details, ExpirationDate = x.ExpirationDate.Value.ToString("yyyy-MM-dd HH:mm:ss"), Effort = x.Effort, RemainingWork = x.RemainingWork, StateId = x.StateId, Activity = x.Activities.Name, Priority = x.Priorities.Name }).FirstOrDefault(); Logica.BL.States states = new Logica.BL.States(); var listStates = states.GetStates(); var json = Json(new { Task = taskViewModel, States = listStates, IsSuccessful = true }); return(json); } catch (Exception ex) { return(Json(new Models.ResponseViewModel { IsSuccessful = false, Errors = new List <string> { ex.Message } })); } }
public IActionResult Create(Logica.Models.BindingModel.TaskCreateBindingModel model) { if (ModelState.IsValid) { Logica.BL.Tasks tasks = new Logica.BL.Tasks(); tasks.CreateTask(model); return(RedirectToAction("Index")); } Logica.BL.States states = new Logica.BL.States(); ViewBag.States = states.GetStates(); Logica.BL.Priorities priorities = new Logica.BL.Priorities(); ViewBag.Priorities = priorities.GetPriorieties(); Logica.BL.Activities activities = new Logica.BL.Activities(); ViewBag.Activities = activities.GetActivities(); return(View(model)); }