Exemple #1
0
        public IHttpActionResult PutContact(int id, Contact contact)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutEmployee(int id, Employee employee)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "Theater_Id,T_ID,Theater_Name,Capacity,Location")] Theater_Info theater_Info)
 {
     if (ModelState.IsValid)
     {
         db.Entry(theater_Info).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(theater_Info));
 }
        public async Task <ActionResult> Edit([Bind(Include = "Movie_Id,M_ID,Movie_Name,Movie_Description,Movie_Rating")] Movie_Info movie_Info)
        {
            if (ModelState.IsValid)
            {
                db.Entry(movie_Info).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(movie_Info));
        }
Exemple #5
0
        public async Task <ActionResult> Edit([Bind(Include = "Employee_Id,E_ID,Employee_Name,Theater_Id,Password,Email,Phone_No,Address")] Employee_Info employee_Info)
        {
            if (ModelState.IsValid)
            {
                db.Entry(employee_Info).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Theater_Id = new SelectList(db.Theater_Info, "Theater_Id", "T_ID", employee_Info.Theater_Id);
            return(View(employee_Info));
        }
Exemple #6
0
        public async Task <ActionResult> Edit([Bind(Include = "Show_Id,S_ID,Theater_Id,Movie_Id,Show_Date,Start_Time,Price,Employee_Id")] Show_Info show_Info)
        {
            if (ModelState.IsValid)
            {
                db.Entry(show_Info).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.Movie_Id    = new SelectList(db.Movie_Info, "Movie_Id", "M_ID", show_Info.Movie_Id);
            ViewBag.Theater_Id  = new SelectList(db.Theater_Info, "Theater_Id", "T_ID", show_Info.Theater_Id);
            ViewBag.Employee_Id = new SelectList(db.Employee_Info, "Employee_Id", "E_ID", show_Info.Employee_Id);
            return(View(show_Info));
        }