public async Task <ActionResult> Edit([Bind(Include = "Id,Name")] Roles roles) { if (User.IsInRole("Administrator")) { if (ModelState.IsValid) { _db.Entry(roles).State = System.Data.Entity.EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(roles)); } return(PartialView("AuthAdminError")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Container,Languages,Support3D")] Format format) { if (User.IsInRole("Administrator")) { if (ModelState.IsValid) { _db.Entry(format).State = System.Data.Entity.EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(format)); } return(PartialView("AuthAdminError")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Title,Description,Date,Genre")] Video video, HttpPostedFileBase Logo) { if (User.IsInRole("Administrator")) { if (ModelState.IsValid) { _db.Entry(video).State = System.Data.Entity.EntityState.Modified; ProcessFile(Logo, video); await _db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(video)); } return(PartialView("AuthAdminError")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,IdUser,IdEdition,Date")] History history) { if (User.IsInRole("Administrator")) { if (ModelState.IsValid) { _db.Entry(history).State = System.Data.Entity.EntityState.Modified; await _db.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewBag.IdEdition = new SelectList(_db.Edition, "Id", "Box", history.IdEdition); ViewBag.IdUser = new SelectList(_db.Users, "Id", "Login", history.IdUser); return(View(history)); } return(PartialView("AuthAdminError")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Login,Password,Email,FirstName,LastName,Address,Discount,IdRole")] Users user) { if (User.IsInRole("Administrator")) { if (ModelState.IsValid) { _db.Entry(user).State = EntityState.Modified; var c = await _db.SaveChangesAsync(); if (c == 1) { return(RedirectToAction("Index")); } return(View(user)); } return(View(user)); } return(PartialView("AuthError")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,IdVideo,IdFormat,Price,Box")] Edition edition) { if (User.IsInRole("Administrator")) { if (ModelState.IsValid) { _db.Entry(edition).State = EntityState.Modified; var c = await _db.SaveChangesAsync(); if (c == 1) { return(RedirectToAction("Index")); } } ViewBag.IdFormat = new SelectList(_db.Format, "Id", "Container", edition.IdFormat); ViewBag.IdVideo = new SelectList(_db.Video, "Id", "Title", edition.IdVideo); return(View(edition)); } return(PartialView("AuthAdminError")); }