Пример #1
0
        public ActionResult Edit(int ID)
        {
            OfficeService service = new OfficeService();
            var           office  = service.Getbykey(ID);

            return(View(office));
        }
Пример #2
0
        public ActionResult Delete(int ID)
        {
            OfficeService service = new OfficeService();

            try
            {
                if (ID < 0)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                var office = service.Getbykey(ID);
                if (office == null)
                {
                    return(HttpNotFound());
                }
                service.Delete(office.OfficeID);

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View("Error"));
            }
        }