Exemplo n.º 1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            if (await CallBusinessTaskSafe(_orderBusiness.DeleteOrder(id)))
            {
                return(RedirectToAction(nameof(Index)));
            }

            var order = await _orderBusiness.GetOrderDetails(id);

            if (order == null)
            {
                return(NotFound());
            }

            return(View("Delete", order));
        }
        public HttpResponseMessage DeleteOrder(OrderModel ParamObj)
        {
            int result = 0;

            try
            {
                result = objbiz.DeleteOrder(ParamObj);

                var response = new HttpResponseMessage(HttpStatusCode.OK);
                if (result == 1)
                {
                    response.Content = new StringContent("Order Deleted Succesfully..!!!");
                }
                response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                return(response);
            }
            catch
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest));
            }
        }
    protected void imgbtnDelete_Click(object sender, ImageClickEventArgs e)
    {
        try
        {
            ImageButton ibRemove = (ImageButton)sender;
            HiddenField hf       = (HiddenField)ibRemove.FindControl("hfOrderOfServiceId");

            OB.DeleteOrder(new Guid(hf.Value));

            pnlGreen.Visible       = true;
            lblSuccess.Text        = "An order has been deleted successfully.";
            hplnkGreen.Text        = "Close and continue.";
            hplnkGreen.NavigateUrl = "";
            loadData();
        }
        catch (Exception ex)
        {
            pnlRed.Visible       = true;
            lblError.Text        = ex.Message;
            hplnkRed.Text        = "Close and continue.";
            hplnkRed.NavigateUrl = "";
        }
    }