Exemplo n.º 1
0
        public IHttpActionResult PostBeautySalons(BeautySalons beautySalons)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.BeautySalons.Add(beautySalons);

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

            return(CreatedAtRoute("DefaultApi", new { id = beautySalons.id }, beautySalons));
        }
Exemplo n.º 2
0
        public IHttpActionResult PutBeautySalons(long id, BeautySalons beautySalons)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

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

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

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

            return(Ok(beautySalons));
        }
        public ActionResult Create([Bind(Include = "Id,lon,lat,Name,ReviewGrade,NumberGrades")] BeautySalons beautySalon)
        {
            if (ModelState.IsValid)
            {
                db.BeautySalons.Add(beautySalon);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(beautySalon));
        }
Exemplo n.º 7
0
        public IHttpActionResult DeleteBeautySalons(long id)
        {
            BeautySalons beautySalons = db.BeautySalons.Find(id);

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

            db.BeautySalons.Remove(beautySalons);
            db.SaveChanges();

            return(Ok(beautySalons));
        }
        // GET: BeautySalons/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BeautySalons beautySalon = db.BeautySalons.Find(id);

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