Exemple #1
0
        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;
            }
        }
Exemple #2
0
        // POST: api/Task

        public IHttpActionResult Post(ProjectViewModel project)
        {
            projectDao.AddProject(project);
            return(Ok());
        }