public void SubmitProject(ModifyProjectViewModel viewModel) { string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; switch (viewModel.Mode) { case "add": case "edit": ProjectModel project = viewModel.ToProjectModel(); project.UserId = userId; if (viewModel.Mode == "add") { projectDao.AddProject(project); } else { projectDao.EditProject(viewModel.ToProjectModel()); } break; case "delete": projectDao.DeleteProjectById(viewModel.Id, userId); break; } }
// POST: api/Task public IHttpActionResult Post(ProjectViewModel project) { projectDao.AddProject(project); return(Ok()); }