public HttpResponseMessage AddUncompCase(UncomplicatedCasesAddRequest model) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } //string userId = HttpContext.Current.User.Identity.GetUserId(); ItemResponse <int> response = new ItemResponse <int>(); response.Item = UncomplicatedCasesService.CreateUncomplicatedCase(model); return(Request.CreateResponse(response)); }
public static int CreateUncomplicatedCase(UncomplicatedCasesAddRequest model)//, string caseId) { var id = 0; DataProvider.ExecuteNonQuery(GetConnection, "dbo.UncomplicatedCases_Insert", inputParamMapper : delegate(SqlParameterCollection InsertUncomplicatedCase) { InsertUncomplicatedCase.AddWithValue("@HospitalID", model.HospitalID); SqlParameter param = new SqlParameter("@Id", SqlDbType.Int); param.Direction = ParameterDirection.Output; InsertUncomplicatedCase.Add(param); }, returnParameters : delegate(SqlParameterCollection par) { int.TryParse(par["@Id"].Value.ToString(), out id); } ); return(id); }