示例#1
0
        public ActionResult CreateCaptureField(int id = 0)
        {
            if (id == 0)
                return HttpNotFound();

            try
            {
                var subscriber = dbContext.Subscribers.Find(id);

                if (subscriber == null)
                    return HttpNotFound();

                var captureField = new CaptureField();

                captureField.SubscriberId = subscriber.SubscriberId;

                ViewBag.subscriber = subscriber;
                return View(captureField);
            }
            catch (Exception ex)
            {
                Util.HandleException(ex.GetBaseException());
                 return RedirectToAction("Error", "Default", null);
            }
        }
示例#2
0
        public ActionResult EditCaptureField(CaptureField captureField)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    dbContext.Entry(captureField).State = EntityState.Modified;

                    dbContext.SaveChanges();

                    return RedirectToAction("Details", "Subscriber", new { id = captureField.SubscriberId });
                }
                else
                {
                    ViewBag.subscriber = captureField.Subscriber;
                    return View(captureField);
                }
            }
            catch (Exception ex)
            {
                Util.HandleException(ex.GetBaseException());
                 return RedirectToAction("Error", "Default", null);
            }
        }