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; } }
public void SubmitProject(ProjectViewModel viewModel) { string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; switch (viewModel.Mode) { case "add": // Can be used later if needed //projectDao.AddProject(viewModel.ToProjectModel()); break; case "edit": ProjectModel project = viewModel.ToProjectModel(); project.UserId = userId; projectDao.EditProject(project); break; case "delete": projectDao.DeleteProjectById(viewModel.Id, userId); break; } }