Beispiel #1
0
        public ActionResult Delete(IEnumerable <waste_hazardous> models)
        {
            foreach (var source in models)
            {
                // Create a new Product entity and set its properties from productViewModel
                waste_hazardous s = db.waste_hazardous.Find(source.id);
                db.waste_hazardous.Remove(s);
                db.SaveChanges();
            }

            return(Json(null));
        }
Beispiel #2
0
        public ActionResult Edit(IEnumerable <waste_hazardous> models)
        {
            foreach (var source in models)
            {
                // Create a new Product entity and set its properties from productViewModel
                waste_hazardous s = db.waste_hazardous.Find(source.id);
                s.name            = source.name;
                s.waste_code      = source.waste_code;
                db.Entry(s).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(null));
        }
Beispiel #3
0
        public ActionResult Create(IEnumerable <waste_hazardous> models)
        {
            List <WasteWrapper> ss = new List <WasteWrapper>();

            //Iterate all created products which are posted by the Kendo Grid
            foreach (var source in models)
            {
                // Create a new Product entity and set its properties from productViewModel
                var s = new waste_hazardous
                {
                    name       = source.name,
                    waste_code = source.waste_code
                };

                db.waste_hazardous.Add(s);
                db.SaveChanges();
                // store the product in the result
                ss.Add(new WasteWrapper {
                    id = s.id, name = s.name, waste_code = s.waste_code
                });
            }
            return(Json(ss.ToList()));
        }