Exemple #1
0
        public ActionResult Compatibility(int ID, FormCollection collection)
        {
            if (!Access.HasAccess(51))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                route.Add("err", "Нет доступа!");
                return(RedirectToAction("Error", "Home", route));
            }
            Devmodel model = new Devmodel();

            model = model.GetById(ID);

            string IDs = collection["MatmodelSelections"];

            model.Matmodels.Clear();
            model.Update(model);

            foreach (string item in IDs.Split(','))
            {
                model.Matmodels.Add((new Matmodel()).GetById(Convert.ToInt32(item)));
            }

            model.Update(model);

            return(RedirectToAction("Index"));
        }
Exemple #2
0
        public ActionResult Edit(int ID, FormCollection collection)
        {
            if (!Access.HasAccess(53))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                route.Add("err", "Нет доступа!");
                return(RedirectToAction("Error", "Home", route));
            }
            try
            {
                Devmodel model = new Devmodel();
                model = model.GetById(ID);

                model.Name = collection["Name"];

                model.Typedev = (new Typedev()).GetById(Convert.ToInt32(collection["Typedev.Id"]));
                model.Vendor  = (new Vendor()).GetById(Convert.ToInt32(collection["Vendor.Id"]));


                model.Update(model);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                return(View());
            }
        }
Exemple #3
0
        public ActionResult Edit(int ID)
        {
            if (!Access.HasAccess(53))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                route.Add("err", "Нет доступа!");
                return(RedirectToAction("Error", "Home", route));
            }
            Devmodel model = new Devmodel();

            model = model.GetById(ID);
            return(View(model));
        }
Exemple #4
0
        public ActionResult Compatibility(int ID)
        {
            if (!Access.HasAccess(51))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                route.Add("err", "Нет доступа!");
                return(RedirectToAction("Error", "Home", route));
            }
            Devmodel model = new Devmodel();

            model = model.GetById(ID);

            return(View(new DevmodelInput()
            {
                TheDevmodel = model,
                MatmodelSelections = (List <Matmodel>)(new Matmodel()).GetAll(),
                SelectedMatmodel = model.Matmodels.Select(x => x.ID).ToList()
            }));
        }
Exemple #5
0
        public ActionResult Delete(int ID)
        {
            if (!Access.HasAccess(55))
            {
                System.Web.Routing.RouteValueDictionary route = new System.Web.Routing.RouteValueDictionary();
                route.Add("err", "Нет доступа!");
                return(RedirectToAction("Error", "Home", route));
            }
            try
            {
                Devmodel model = new Devmodel();
                model = model.GetById(ID);

                model.Delete(model);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                return(View());
            }
        }