Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Brouchure brouchure = await db.Brouchures.FindAsync(id);

            db.Brouchures.Remove(brouchure);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> GetBrouchure(int id)
        {
            Brouchure brouchure = await db.Brouchures.FindAsync(id);

            if (brouchure == null)
            {
                return(NotFound());
            }

            return(Ok(brouchure));
        }
Exemplo n.º 4
0
 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,
     });
 }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        // 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));
        }
Exemplo n.º 7
0
        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));
        }