Ejemplo n.º 1
0
        public ActionResult Edit(ShiftRight.Heim.Models.Attribute attr)
        {
            using(var dtx = new HeimContext()) {

                if(this.ModelState.IsValid) {
                    dtx.Entry<ShiftRight.Heim.Models.Attribute>(attr).State = System.Data.Entity.EntityState.Modified;
                    dtx.SaveChanges();
                }

                return RedirectToAction("Edit", "Plans", new { id = attr.PlanID });
            }
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Exclude = "ID")] AssetViewModel mat)
        {
            using(var dtx = new HeimContext()) {

                if(ModelState.IsValid) {

                    mat.Created = DateTimeOffset.UtcNow;
                    mat.Updated = mat.Created;

                    dtx.Assets.Add(mat as Asset);
                    dtx.SaveChanges();

                    SaveAssetFiles(dtx, mat);

                    dtx.Entry<Asset>(mat as Asset).State = EntityState.Modified;
                    dtx.SaveChanges();
                }

                return View(mat);
            }
        }
Ejemplo n.º 3
0
        public ActionResult Edit(AssetViewModel asset)
        {
            using(var dtx = new HeimContext()) {

                asset.Updated = DateTimeOffset.UtcNow;

                SaveAssetFiles(dtx, asset);

                dtx.Entry<Asset>(asset).State = EntityState.Modified;
                dtx.SaveChanges();

                return View(asset);
            }
        }