Example #1
0
 public ActionResult Edit([Bind(Include = "BusinessId,BusinessName")] Business business)
 {
     if (ModelState.IsValid)
     {
         db.Entry(business).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(business));
 }
Example #2
0
 public ActionResult Edit([Bind(Include = "UserId,Username,FullName,PassWord,Email,Avatar,IsAdmin,Allowed")] Administrator administrator)
 {
     if (ModelState.IsValid)
     {
         administrator.PassWord        = Common.EncryptMD5(administrator.Username + administrator.PassWord);
         db.Entry(administrator).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(administrator));
 }
Example #3
0
 public ActionResult Edit([Bind(Include = "PermissionId,PermissionName,Description,BusinessId")] Permission permission)
 {
     if (ModelState.IsValid)
     {
         db.Entry(permission).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BusinessId = new SelectList(db.Business, "BusinessId", "BusinessName", permission.BusinessId);
     return(View(permission));
 }
Example #4
0
 public ActionResult Edit([Bind(Include = "CategoryId,CategoryName,OrderNo,Status,UserId")] Category category)
 {
     if (ModelState.IsValid)
     {
         db.Entry(category).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId = new SelectList(db.Administrator, "UserId", "Username", category.UserId);
     return(View(category));
 }
Example #5
0
 public ActionResult Edit([Bind(Include = "PermissionId,UserId,Description")] GrantPermission grantPermission)
 {
     if (ModelState.IsValid)
     {
         db.Entry(grantPermission).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId       = new SelectList(db.Administrator, "UserId", "Username", grantPermission.UserId);
     ViewBag.PermissionId = new SelectList(db.Permission, "PermissionId", "PermissionName", grantPermission.PermissionId);
     return(View(grantPermission));
 }
Example #6
0
 public ActionResult Edit([Bind(Include = "PostId,CategoryId,UserId,Title,Brief,Content,Picture,DateCreate,Tags,ViewNo,Status")] Post post)
 {
     if (ModelState.IsValid)
     {
         db.Entry(post).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserId     = new SelectList(db.Administrator, "UserId", "Username", post.UserId);
     ViewBag.CategoryId = new SelectList(db.Category, "CategoryId", "CategoryName", post.CategoryId);
     return(View(post));
 }