public async Task <IHttpActionResult> PostdetalleServicio(detalleServicio detalleServicio)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.detalleServicio.Add(detalleServicio);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (detalleServicioExists(detalleServicio.id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = detalleServicio.id }, detalleServicio));
        }
        public async Task <IHttpActionResult> PutdetalleServicio(int id, detalleServicio detalleServicio)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            detalleServicio detalleServicio = db.detalleServicio.Find(id);

            db.detalleServicio.Remove(detalleServicio);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public async Task <IHttpActionResult> GetdetalleServicio(int id)
        {
            detalleServicio detalleServicio = await db.detalleServicio.FindAsync(id);

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

            return(Ok(detalleServicio));
        }
 public ActionResult Edit([Bind(Include = "idDetalleServicio,idpersona,idservicio,idimagen,cantidadcomentario")] detalleServicio detalleServicio)
 {
     if (ModelState.IsValid)
     {
         db.Entry(detalleServicio).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.idimagen   = new SelectList(db.imagen, "idimagen", "ruta", detalleServicio.idimagen);
     ViewBag.idpersona  = new SelectList(db.persona, "idpersona", "idDistrito", detalleServicio.idpersona);
     ViewBag.idservicio = new SelectList(db.servicio, "idservicio", "nombreServicio", detalleServicio.idservicio);
     return(View(detalleServicio));
 }
        public async Task <IHttpActionResult> DeletedetalleServicio(int id)
        {
            detalleServicio detalleServicio = await db.detalleServicio.FindAsync(id);

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

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

            return(Ok(detalleServicio));
        }
        // GET: detalleServicios/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            detalleServicio detalleServicio = db.detalleServicio.Find(id);

            if (detalleServicio == null)
            {
                return(HttpNotFound());
            }
            return(View(detalleServicio));
        }
        // GET: detalleServicios/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            detalleServicio detalleServicio = db.detalleServicio.Find(id);

            if (detalleServicio == null)
            {
                return(HttpNotFound());
            }
            ViewBag.idimagen   = new SelectList(db.imagen, "idimagen", "ruta", detalleServicio.idimagen);
            ViewBag.idpersona  = new SelectList(db.persona, "idpersona", "idDistrito", detalleServicio.idpersona);
            ViewBag.idservicio = new SelectList(db.servicio, "idservicio", "nombreServicio", detalleServicio.idservicio);
            return(View(detalleServicio));
        }