public static int usp_user_restaurantadd(GestDetail _ListAdd) { int userid = 0; using (var connection = SQLConnection.GetOpenSQLConnection()) { string sqlQuery = "usp_user_restaurantadd @tablenumber,@headcount,@guestname,@phonenumber"; userid = connection.Query <int>(sqlQuery, new { tablenumber = _ListAdd.tablenumber, headcount = _ListAdd.headcount, guestname = _ListAdd.guestname, phonenumber = _ListAdd.phonenumber }).FirstOrDefault(); } return(userid); }
public HttpResponseMessage RestaurantAdd(GestDetail _ListAdd) { HttpResponseMessage response; try { if (string.IsNullOrWhiteSpace(_ListAdd.guestname)) { response = Request.CreateResponse(HttpStatusCode.PreconditionFailed, "Name can not be blank!"); } else { int new_user_id = RegistrationProcCall.usp_user_restaurantadd(_ListAdd); response = Request.CreateResponse(HttpStatusCode.OK, new_user_id); } } catch (Exception) { response = Request.CreateResponse(HttpStatusCode.InternalServerError); } return(response); }