Exemplo n.º 1
0
 public ActionResult Add(TaskModal modal)
 {
     if (ModelState.IsValid)
     {
         int add = task.AddTask(modal);
         return(RedirectToAction("ViewAll"));
     }
     ModelState.Clear();
     return(View());
 }
Exemplo n.º 2
0
        /// <summary>
        /// Opens form to get data and adds data to grid.
        /// </summary>
        private void AddTaskToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var frm = new TaskForm(Task, false); // ITask argument, no edit mode,

            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                Task.AddTask(DataTab);
                statusStrip.Items[0].Visible = false;
            }
        }
Exemplo n.º 3
0
        public async Task <IActionResult> PostTask(TaskRequest request, int id)
        {
            Response result = await _task.AddTask(request, id);

            if (!result.IsSuccess)
            {
                return(NotFound(result.Message));
            }

            return(Ok(result));
        }
Exemplo n.º 4
0
        public IActionResult Create(Task tasked)

        {
            if (ModelState.IsValid)
            {
                Task newTask = _taskrepository.AddTask(tasked);


                return(RedirectToAction("Details", new { Id = newTask.Id }));
            }
            else
            {
                return(View());
            }
        }
Exemplo n.º 5
0
        public async Task <IActionResult> AddTask([FromBody] TaskTypeViewModel taskTypeViewModel)
        {
            try
            {
                var result = await _task.AddTask(taskTypeViewModel);

                if (result != 0)
                {
                    var Response = new ResponseViewModel(true, HttpStatusCode.OK, "SUCCESS", result);
                    return(Ok(Response));
                }

                else
                {
                    var Response = new ResponseViewModel(false, HttpStatusCode.NoContent, "failed", null);
                    return(Ok(Response));
                }
            }

            catch
            {
                return(BadRequest());
            }
        }