Exemple #1
0
        public void Update(ToppingUpdateRequest req)
        {
            using (var con = GetConnection())
            {
                var cmd = con.CreateCommand();
                cmd.CommandText = "dbo.Toppings_Update";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Id", req.Id);
                cmd.Parameters.AddWithValue("@Name", req.Name);
                cmd.Parameters.AddWithValue("@ToppingImage", req.ToppingImage);
                cmd.Parameters.AddWithValue("@IsSauce", req.isSauce);

                cmd.ExecuteNonQuery();
            }
        }
Exemple #2
0
        public ActionResult <SuccessResponse> Update(ToppingUpdateRequest req)
        {
            SuccessResponse response = null;
            ActionResult    result   = null;

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

            return(result);
        }