public string Insert(Project project) { if (String.IsNullOrEmpty(project.Name)) { return "bad_request"; } else if (!ProjectsRep.CheckProjectNameUniqueness(project.Name)) { return "conflict"; } return ProjectsRep.Insert(project).ToString(); }
public long Post(Project project) { var returnedValue = projectsBusiness.Insert(project); long id = 0; bool isNum = long.TryParse(returnedValue, out id); if (!isNum) { if (returnedValue == "bad_request") { throw new ApiException(HttpStatusCode.BadRequest, "Supplied parameters in the request are malformed"); } else { throw new ApiException(HttpStatusCode.Conflict, "There is already a same project wih supplied information"); //if email is not unique } } return id; //returns Success[200] }