public ActionResult CreateRequest()
        {
            var crRqModel = new CreateRequestVmodel();

            var items = HttpContext.GetOwinContext().Get <ApplicationContext>().RequestCategories
                        .Select(c => new SelectListItem()
            {
                Value = c.CategoryName, Text = c.CategoryName
            }).ToList();

            crRqModel.Categories = new SelectList(items, "Value", "Text");
            return(View(crRqModel));
        }
        public async Task <ActionResult> CreateRequest(CreateRequestVmodel model)
        {
            var items = HttpContext.GetOwinContext().Get <ApplicationContext>().RequestCategories
                        .Select(c => new SelectListItem()
            {
                Value = c.CategoryName, Text = c.CategoryName
            }).ToList();

            model.Categories = new SelectList(items, "Value", "Text");
            if (ModelState.IsValid)
            {
                var            db = HttpContext.GetOwinContext().Get <ApplicationContext>();
                SupportRequest sr = new SupportRequest
                {
                    ClientName = model.ClientName,
                    Category   = model.Category,
                    Phone      = model.Phone,
                    Operator   = HttpContext.User.Identity.Name,
                    RqText     = model.Text,
                    State      = "Зарегистрирован",
                    Time       = DateTime.Now
                };
                bool _success = true;
                try
                {
                    db.SupportRequests.Add(sr);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    _success = false;
                }

                if (_success)
                {
                    return(RedirectToAction("Index", "Operator"));
                }
            }
            return(View(model));
        }