Ejemplo n.º 1
0
        public async Task <IHttpActionResult> Postevloc(evloc evloc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.evloc.Add(evloc);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (evlocExists(evloc.evloc1))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = evloc.evloc1 }, evloc));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> Putevloc(int id, evloc evloc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != evloc.evloc1)
            {
                return(BadRequest());
            }

            db.Entry(evloc).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!evlocExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> Getevloc(int id)
        {
            evloc evloc = await db.evloc.FindAsync(id);

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

            return(Ok(evloc));
        }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> Deleteevloc(int id)
        {
            evloc evloc = await db.evloc.FindAsync(id);

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

            db.evloc.Remove(evloc);
            await db.SaveChangesAsync();

            return(Ok(evloc));
        }