public ActionResult Create(RedirectTypeValue redirecttypevalue)
        {
            if (ModelState.IsValid)
            {
                redirecttypevalue.Id = Guid.NewGuid();
                db.RedirectTypeValues.Add(redirecttypevalue);
                db.SaveChanges();
                //return RedirectToAction("Index");
                return BreadCrum.RedirectToPreviousAction(Session, ControllerName);

            }

            ViewBag.RedirectTypeId = new SelectList(db.RedirectTypes, "Id", "Name", redirecttypevalue.RedirectTypeId);
            return View(redirecttypevalue);
        }
 public ActionResult Edit(RedirectTypeValue redirecttypevalue)
 {
     if (ModelState.IsValid)
     {
         db.Entry(redirecttypevalue).State = EntityState.Modified;
         db.SaveChanges();
         return BreadCrum.RedirectToPreviousAction(Session, ControllerName);
     }
     ViewBag.RedirectTypeId = new SelectList(db.RedirectTypes, "Id", "Name", redirecttypevalue.RedirectTypeId);
     return View(redirecttypevalue);
 }
        private Dictionary<string, string> FillRedirectType(HttpBrowserCapabilitiesBase browser)
        {
            var result = new Dictionary<string, string>();
            if (browser.IsMobileDevice)
            {
                //can use also browser.MobileDeviceManufacturer
                var screenHeight = browser.ScreenPixelsHeight;
                var screenWidth = browser.ScreenPixelsWidth;

                //create the the scaling code for the html5 plugin accordingly, on $ready
            }
            var properties = db.RedirectTypes.ToList();
            foreach (var property in properties)
            {
                //find the browser property if any
                var browserProperty = browser.GetType().GetProperty(property.Name);
                if (browserProperty != null)
                {
                    var broserValue = browserProperty.GetValue(browser, null);
                    if (broserValue != null)
                    {
                        var stringValue = broserValue.ToString();
                        var value =
                            db.RedirectTypeValues.SingleOrDefault(
                                row => row.RedirectTypeId == property.Id && row.Name == stringValue);
                        if (value == null)
                        {
                            value = new RedirectTypeValue
                                {
                                    Id = Guid.NewGuid(),
                                    Name = stringValue,
                                    RedirectTypeId = property.Id
                                };
                            db.RedirectTypeValues.Add(value);
                            db.SaveChanges();
                        }
                        result.Add(property.Name, stringValue);
                    }
                }
            }
            return result;
        }