Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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);
        }