Example #1
0
 public IHttpActionResult Delete(ProjectDevelopmentViewModel model)
 {
     try
     {
         _serviceProjectDevelopment.DeleteProjectDevelopment(model.Id);
         return(Ok());
     }
     catch (InvalidOperationException ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Example #2
0
        public IHttpActionResult Post(ProjectDevelopmentViewModel model)
        {
            if (ModelState.IsValid)
            {
                var project = _serviceProjectDevelopment.CreateProjectDevelopment(
                    enhancementRequestId: model.EnhancementRequestId,
                    employeeInDevelopmentPositionId: model.ManagerId,
                    description: String.Empty,
                    start: model.Start,
                    finish: model.Finish);

                model.Id = project.Id;

                return(Created <ProjectDevelopmentViewModel>(Request.RequestUri + model.Id.ToString(), model));
            }

            return(BadRequest(ModelState));
        }
Example #3
0
        public IHttpActionResult Put(ProjectDevelopmentViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var project = _serviceProjectDevelopment.UpdateProjectDevelopment(
                        id: model.Id,
                        enhancementRequestId: model.EnhancementRequestId,
                        employeeInDevelopmentPositionId: model.ManagerId,
                        description: String.Empty,
                        start: model.Start,
                        finish: model.Finish);

                    return(Ok(project));
                }
                catch (InvalidOperationException ex)
                {
                    return(BadRequest(ex.Message));
                }
            }

            return(BadRequest(ModelState));
        }