Esempio n. 1
0
 public IHttpActionResult CreateProject([FromBody] Project project)
 {
     if (string.IsNullOrEmpty(project.Owner))
     {
         return(BadRequest("An owner must exist"));
     }
     if (string.IsNullOrEmpty(project.Name))
     {
         return(BadRequest("A name must exist"));
     }
     if (string.IsNullOrEmpty(project.Description))
     {
         return(BadRequest("A description must exist"));
     }
     try
     {
         return(Ok(_dataAccess.CreateProject(project)));
     }
     catch (Exception ex)
     {
         return(ResponseMessage(Request.CreateErrorResponse(HttpStatusCode.Conflict, ex.Message)));
     }
 }