Exemplo n.º 1
0
        public ActionResult AssetTableExpressPartialDelete(string Id)
        {
            Id = Id.Replace("\"", "");
            if (string.IsNullOrEmpty(Id))
            {
                Id = "0";
            }
            int id    = Int32.Parse(Id);
            var model = new AssetListPartialModel();

            if (id > 0)
            {
                try
                {
                    var a = db.Read(id);
                    if (isAuthorized(a.Customer.Id) == AuthState.NoAuth)
                    {
                        return(PartialView("NotAuthorizedPatialPopup"));
                    }
                    db.Delete(a);

                    model.Assets     = db.ReadAllWithFk(a.Customer.Id);
                    model.CustomerId = a.Customer.Id;
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            return(PartialView("~/Views/Customers/_AssetTableExpressPartial.cshtml", model));
        }
Exemplo n.º 2
0
        public ActionResult AssetTableExpressPartial(int?customerid)
        {
            var model = new AssetListPartialModel();

            if (customerid.HasValue)
            {
                if (isAuthorized(customerid.Value) == AuthState.NoAuth)
                {
                    return(PartialView("NotAuthorizedPartical"));
                }
                model.Assets     = db.ReadAllWithFk(customerid.Value);
                model.CustomerId = customerid.Value;
            }
            return(PartialView("~/Views/Customers/_AssetTableExpressPartial.cshtml", model));
        }