public HttpResponseMessage Get() { try { var project = repository.Get().Select(b => new TaskModel() { Project_ID = b.Project_ID, Task_Name = b.Task_Name, Start_Date = b.Start_Date, End_Date = b.End_Date, Priority = (int)b.Priority, ParentTask_Name = b.ParentTask == null ? "" : b.ParentTask.Parent_Task, Parent_ID = b.Parent_ID, Task_ID = b.Task_ID, Status = b.Status }); return(ToJson(project)); } catch (Exception ex) { LogError.Log(ex); return(ToJson(null)); } }
public IActionResult Edit(TaskModel task, [FromForm] IFormFileCollection Images) { if (ModelState.IsValid) { unitOfWork.Tasks.SaveTask(task, Images); unitOfWork.SaveChangesTaskContext(); return(RedirectToAction("Tasks", new { projectId = task.ProjectID, listType = task.ListType })); } else { if (task.TaskID == 0) { ViewBag.PostDate = DateTime.Now.ToString("dd-MM-yyyy"); ViewBag.Title = "Create New Task"; } else { TaskModel currentTask = tasksRepository.Get(task.TaskID); ViewBag.Comments = currentTask.TaskComments; ViewBag.PostDate = currentTask.PostDate; ViewBag.Deadline = currentTask.Deadline; ViewBag.Title = "Edit Task"; } return(View(task)); } }
public ActionResult TaskForm(bool IsExisting, int Id = 0) { var config = new MapperConfiguration(cfg => { cfg.CreateMap <TaskFull, TaskFullViewModel>().ForMember(dest => dest.Category, opt => opt.MapFrom(src => src.Category.Id)).ForMember(dest => dest.Status, opt => opt.MapFrom(src => src.Status.Id)).ForMember(dest => dest.Rank, opt => opt.MapFrom(src => src.Rank.Id)); }); IMapper mapper = config.CreateMapper(); var Viewmodel = new TaskFormViewModel() { RankList = _staticDataRepository.GetRanksDropdown(), CategoryList = _staticDataRepository.GetCategoriesDropdown(_usersRepository.GetCurrentUserId()), StatusList = _staticDataRepository.GetStatusesDropdown(), Task = new TaskFullViewModel() { Id = 0, Progres = 0 } }; if (IsExisting) { Viewmodel.Task = mapper.Map <TaskFull, TaskFullViewModel>(_tasksRepository.Get(Id, _usersRepository.GetCurrentUserId())); ViewBag.Title = "Edit task"; Viewmodel.IsExisting = true; } else { ViewBag.Title = "Add new task"; Viewmodel.IsExisting = false; } return(View(Viewmodel)); }
public IActionResult Delete(int id, int projectId) { if (tasksRepo.Get(id) == null) { return(ProjectDetailsWithError(projectId, NOT_FOUND_ERROR)); } tasksRepo.Delete(id); return(ProjectDetails(projectId)); }
/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public WorkflowTaskViewModel GetTask(int id) { WorkflowTaskPoco task = _tasksRepo.Get(id); return(ConvertToWorkflowTaskList(task.AsEnumerableOfOne().ToList()).FirstOrDefault()); }
public IActionResult Get() { return(Ok(taskRepository.Get())); }
public List <Task> GetAllPendent() { var tasks = _tasksRepository.Get(x => x.Status == TaskStatus.Pendente); return(tasks != null?tasks.ToList() : new List <Task>()); }