public bool SaveTask(TaskHead modelData)
 {
     bool bSuccess = false;
     try
     {
         ProTask taskData;
         if (modelData.TaskId > 0)
         {
             taskData = taskRepositry.GetTask(modelData.TaskId);
             modelData.ModifiedOn = DateTime.Now;
             modelData.ModifiedBy = userService.GetLoggdInUser().UserId;
         }
         else
         {
             taskData = new ProTask();
             modelData.CreatedOn = DateTime.Now;
             modelData.CreatedBy = userService.GetLoggdInUser().UserId;
         }
         modelData.RepeatTask = (modelData.IsRepeatTask) ? 1 : 0;
         taskData = MapperConfig.Mapper.Map<TaskHead, ProTask>(modelData, taskData);
         taskData.CompanyId = userService.GetLoggdInUser().CompanyId;
         taskData.BranchId = userService.GetLoggdInUser().BranchId;
         bSuccess = taskRepositry.SaveTask(taskData);
     }
     catch (Exception ex)
     {
         logger.LogError(ex, ex.Message);
     }
     return bSuccess;
 }
 public ActionResult Comments([Bind(Include = "Id, Comment")] ProTask proTask)
 {
     if (ModelState.IsValid)
     {
         TaskHelper.EditComment(proTask.Id, proTask.Comment);
         return(RedirectToAction("Index", "ProTasks", new { userId = User.Identity.GetUserId() }));
     }
     return(View());
 }
 public ActionResult EditDeveloperTask([Bind(Include = "Id,CompletedPercentage")] ProTask proTask)
 {
     if (ModelState.IsValid)
     {
         TaskHelper.EditDeveloperTask(proTask.Id, proTask.CompletedPercentage);
         return(RedirectToAction("Index", "ProTasks", new { userId = User.Identity.GetUserId() }));
     }
     return(View());
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Content,UserId,Deadline,Priority,CompletedPercentage")] ProTask proTask)
 {
     if (ModelState.IsValid)
     {
         TaskHelper.Edit(proTask.Id, proTask.Name, proTask.Content, proTask.UserId, proTask.Deadline, proTask.Priority, proTask.CompletedPercentage);
         return(RedirectToAction("Index", "Projects"));
     }
     ViewBag.UserId = new SelectList(TaskHelper.GetListOfUsers(), "Id", "Email");
     return(View());
 }
        // GET: ProTasks/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProTask proTask = TaskHelper.GetTask((int)id);

            if (proTask == null)
            {
                return(HttpNotFound());
            }
            return(View(proTask));
        }
        // GET: ProTasks/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ProTask proTask = TaskHelper.GetTask((int)id);

            if (proTask == null)
            {
                return(HttpNotFound());
            }
            ViewBag.UserId = new SelectList(TaskHelper.GetListOfUsers(), "Id", "Email");
            return(View(proTask));
        }
Example #7
0
 public bool SaveTask(ProTask proTask)
 {
     return(dbContext.SaveChanges() > 0);
 }