public async Task <ActionResult> DeleteConfirmed(int id) { SocialStyle socialStyle = await db.SocialStyles.FindAsync(id); db.SocialStyles.Remove(socialStyle); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Name,Description,Url,File")] SocialStyle socialStyle) { if (ModelState.IsValid) { socialStyle.UploadFile(); db.Entry(socialStyle).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(socialStyle)); }
// GET: SocialStyles/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SocialStyle socialStyle = await db.SocialStyles.FindAsync(id); if (socialStyle == null) { return(HttpNotFound()); } return(View(socialStyle)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Name,Description,Url,File")] SocialStyle socialStyle) { if (ModelState.IsValid) { db.SocialStyles.Add(socialStyle); await db.SaveChangesAsync(); socialStyle.UploadFile(); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(socialStyle)); }