Ejemplo n.º 1
0
        public IHttpActionResult PostClothingShops(ClothingShops clothingShops)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ClothingShops.Add(clothingShops);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ClothingShopsExists(clothingShops.id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = clothingShops.id }, clothingShops));
        }
Ejemplo n.º 2
0
        public IHttpActionResult PutClothingShops(long id, ClothingShops clothingShops)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClothingShopsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            ClothingShops clothingShop = db.ClothingShops.Find(id);

            db.ClothingShops.Remove(clothingShop);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 4
0
 public ActionResult Edit([Bind(Include = "Id,lon,lat,Name,ReviewGrade,NumberGrades")] ClothingShops clothingShop)
 {
     if (ModelState.IsValid)
     {
         db.Entry(clothingShop).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(clothingShop));
 }
Ejemplo n.º 5
0
        public IHttpActionResult GetClothingShops(long id)
        {
            ClothingShops clothingShops = db.ClothingShops.Find(id);

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

            return(Ok(clothingShops));
        }
Ejemplo n.º 6
0
        public ActionResult Create([Bind(Include = "Id,lon,lat,Name,ReviewGrade,NumberGrades")] ClothingShops clothingShop)
        {
            if (ModelState.IsValid)
            {
                db.ClothingShops.Add(clothingShop);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(clothingShop));
        }
Ejemplo n.º 7
0
        public IHttpActionResult DeleteClothingShops(long id)
        {
            ClothingShops clothingShops = db.ClothingShops.Find(id);

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

            db.ClothingShops.Remove(clothingShops);
            db.SaveChanges();

            return(Ok(clothingShops));
        }
Ejemplo n.º 8
0
        // GET: ClothingShops/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ClothingShops clothingShop = db.ClothingShops.Find(id);

            if (clothingShop == null)
            {
                return(HttpNotFound());
            }
            return(View(clothingShop));
        }