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

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> GetCustomLargeDataEntity(int id)
        {
            CustomLargeDataEntity customLargeDataEntity = await db.CustomLargeDataEntities.FindAsync(id);

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

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

            db.CustomLargeDataEntities.Add(customLargeDataEntity);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = customLargeDataEntity.Id }, customLargeDataEntity));
        }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> DeleteCustomLargeDataEntity(int id)
        {
            CustomLargeDataEntity customLargeDataEntity = await db.CustomLargeDataEntities.FindAsync(id);

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

            db.CustomLargeDataEntities.Remove(customLargeDataEntity);
            await db.SaveChangesAsync();

            return(Ok(customLargeDataEntity));
        }