Exemplo n.º 1
0
        public async Task <IHttpActionResult> Putservices_comments(int id, services_comments services_comments)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> Getservices_comments(int id)
        {
            services_comments services_comments = await db.services_comments.FindAsync(id);

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

            return(Ok(services_comments));
        }
Exemplo n.º 3
0
        public async Task <IHttpActionResult> Postservices_comments(services_comments services_comments)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.services_comments.Add(services_comments);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = services_comments.id }, services_comments));
        }
Exemplo n.º 4
0
        public async Task <IHttpActionResult> Deleteservices_comments(int id)
        {
            services_comments services_comments = await db.services_comments.FindAsync(id);

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

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

            return(Ok(services_comments));
        }