public IHttpActionResult CompanyCredit() { MitBudDBEntities mitBud = new MitBudDBEntities(); var userId = RequestContext.Principal.Identity.GetUserId(); var findCompanyCredit = mitBud.Companies.Where(x => x.UserId == userId).SingleOrDefault(); if (findCompanyCredit != null) { var substractCompanyCredit = findCompanyCredit.CompanyCredit = findCompanyCredit.CompanyCredit - 1; if (substractCompanyCredit > -1) { CompanyProvider.updateCredit(substractCompanyCredit, userId); } else { return(Content(HttpStatusCode.BadRequest, "You have no credit left")); } } else { return(NotFound()); } return(Ok()); // var dd = HttpStatusCode.Accepted; // var responseMsg = new HttpResponseMessage(dd) // { // Content = new StringContent("", Encoding.UTF8, "application/json") // }; //} }