Ejemplo n.º 1
0
        public async Task <IHttpActionResult> PutHackWell(decimal id, HackWell hackWell)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hackWell.well_fac_id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> PostHackWell(HackWell hackWell)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.HackWells.Add(hackWell);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (HackWellExists(hackWell.well_fac_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = hackWell.well_fac_id }, hackWell));
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> DeleteHackWell(decimal id)
        {
            HackWell hackWell = await db.HackWells.FindAsync(id);

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

            db.HackWells.Remove(hackWell);
            await db.SaveChangesAsync();

            return(Ok(hackWell));
        }