public async Task <IHttpActionResult> PutBrouchure(int id, Brouchure brouchure) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != brouchure.BrouchureId) { return(BadRequest()); } db.Entry(brouchure).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BrouchureExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <ActionResult> DeleteConfirmed(int id) { Brouchure brouchure = await db.Brouchures.FindAsync(id); db.Brouchures.Remove(brouchure); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> GetBrouchure(int id) { Brouchure brouchure = await db.Brouchures.FindAsync(id); if (brouchure == null) { return(NotFound()); } return(Ok(brouchure)); }
private BrouchureView ToView(Brouchure brouchure) { return(new BrouchureView { BrochureDescription = brouchure.BrochureDescription, BrouchureId = brouchure.BrouchureId, BrouchureImage = brouchure.BrouchureImage, LastUpdate = brouchure.LastUpdate, PerfilId = brouchure.PerfilId, Perfil = brouchure.Perfil, }); }
public async Task <IHttpActionResult> PostBrouchure(Brouchure brouchure) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Brouchures.Add(brouchure); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = brouchure.BrouchureId }, brouchure)); }
// GET: Brouchures/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Brouchure brouchure = await db.Brouchures.FindAsync(id); if (brouchure == null) { return(HttpNotFound()); } return(View(brouchure)); }
public async Task <IHttpActionResult> DeleteBrouchure(int id) { Brouchure brouchure = await db.Brouchures.FindAsync(id); if (brouchure == null) { return(NotFound()); } db.Brouchures.Remove(brouchure); await db.SaveChangesAsync(); return(Ok(brouchure)); }