示例#1
0
        public void Insert(PizzaToppingInsertRequest req)
        {
            using (var con = GetConnection())
            {
                var cmd = con.CreateCommand();
                cmd.CommandText = "dbo.PizzaToppings_Insert";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@PizzaId", req.PizzaId);
                cmd.Parameters.AddWithValue("@ToppingId", req.ToppingId);

                cmd.ExecuteNonQuery();
            }
        }
示例#2
0
        public ActionResult <SuccessResponse> Insert(PizzaToppingInsertRequest req)
        {
            SuccessResponse response = null;
            ActionResult    result   = null;


            try
            {
                _pizzaToppingService.Insert(req);
                response = new SuccessResponse();
                result   = Ok(response);
            }
            catch (Exception ex)
            {
                result = StatusCode(500, new ErrorResponse(ex.Message));
            }
            return(result);
        }