Пример #1
0
 public void Update(Asset asset)
 {
     asset.Username = this._username;
     db.Assets.Attach(asset);
     db.Entry(asset).State = EntityState.Modified;
     db.SaveChanges();
 }
Пример #2
0
 public void Delete(Asset asset)
 {
     if (db.Entry(asset).State == EntityState.Detached)
     {
         db.Assets.Attach(asset);
     }
     db.Assets.Remove(asset);
     db.SaveChanges();
 }
Пример #3
0
        public ActionResult Create(Asset asset)
        {
            IAssetRepository repository = new EFAssetRepository(User.Identity.Name);
            if (ModelState.IsValid)
            {
                repository.Insert(asset);
                return RedirectToAction("Index");
            }

            return View(asset);
        }
Пример #4
0
 public void Insert(Asset asset)
 {
     asset.Username = this._username;
     db.Assets.Add(asset);
     db.SaveChanges();
 }
Пример #5
0
 public void Update(Asset asset)
 {
     throw new NotImplementedException();
 }
Пример #6
0
 public void Insert(Asset asset)
 {
     throw new NotImplementedException();
 }
Пример #7
0
 //
 // GET: /Asset/Create
 public ActionResult Create()
 {
     // return View();
     Asset asset = new Asset();
     return View(asset);
 }