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

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 2
0
        public async Task <IHttpActionResult> GetVisualSettingsModel(int id)
        {
            VisualSettingsModel visualSettingsModel = await db.VisualSettingsModels.FindAsync(id);

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

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

            db.VisualSettingsModels.Add(visualSettingsModel);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = visualSettingsModel.Id }, visualSettingsModel));
        }
Ejemplo n.º 4
0
        public async Task <IHttpActionResult> DeleteVisualSettingsModel(int id)
        {
            VisualSettingsModel visualSettingsModel = await db.VisualSettingsModels.FindAsync(id);

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

            db.VisualSettingsModels.Remove(visualSettingsModel);
            await db.SaveChangesAsync();

            return(Ok(visualSettingsModel));
        }