Ejemplo n.º 1
0
        public async Task <IHttpActionResult> PutTurfMaster(int id, TurfMaster turfMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != turfMaster.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> GetTurfMaster(int id)
        {
            TurfMaster turfMaster = await db.TurfMasters.FindAsync(id);

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

            return(Ok(turfMaster));
        }
Ejemplo n.º 3
0
        public async Task <IHttpActionResult> PostTurfMaster(TurfMaster turfMaster)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TurfMasters.Add(turfMaster);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = turfMaster.Id }, turfMaster));
        }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> DeleteTurfMaster(int id)
        {
            TurfMaster turfMaster = await db.TurfMasters.FindAsync(id);

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

            db.TurfMasters.Remove(turfMaster);
            await db.SaveChangesAsync();

            return(Ok(turfMaster));
        }