Example #1
0
        public ActionResult Create(SoftwareLicense softwarelicense)
        {
            #region Authorization
            if( Authentication.IsAdmin == false )
            {
                return RedirectToAction( "Login", "Users" );
            }
            #endregion

            if (ModelState.IsValid)
            {
                db.Licenses.Add(softwarelicense);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(softwarelicense);
        }
Example #2
0
        public ActionResult Edit(SoftwareLicense softwarelicense)
        {
            #region Authorization
            if( Authentication.IsAdmin == false )
            {
                return RedirectToAction( "Login", "Users" );
            }
            #endregion

            if (ModelState.IsValid)
            {
                db.Entry(softwarelicense).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(softwarelicense);
        }