public ActionResult Add(TaskModal modal) { if (ModelState.IsValid) { int add = task.AddTask(modal); return(RedirectToAction("ViewAll")); } ModelState.Clear(); return(View()); }
/// <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; } }
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)); }
public IActionResult Create(Task tasked) { if (ModelState.IsValid) { Task newTask = _taskrepository.AddTask(tasked); return(RedirectToAction("Details", new { Id = newTask.Id })); } else { return(View()); } }
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()); } }