Beispiel #1
0
        public AdUserByEgnViewModel GetUserByEgn(long egn)
        {
            AdUser user = this.Context.AdAccounts.Where(u => u.Egn == egn).FirstOrDefault();

            if (user == null)
            {
                return(null);
            }

            AdUserByEgnViewModel uv = Mapper.Map <AdUser, AdUserByEgnViewModel>(user);

            return(uv);
        }
Beispiel #2
0
        // GET: Users by EGN
        public ActionResult Result(string egn)
        {
            if (egn != string.Empty)
            {
                var egnLong = long.Parse(egn);

                AdUserByEgnViewModel user = this.service.GetUserByEgn(egnLong);

                if (user == null)
                {
                    ViewData["ErrorMessage"] = "Не е намерен потребител по търсеното ЕГН!";

                    return(RedirectToAction("Index", "Home"));
                }

                return(View(user));
            }

            return(RedirectToAction("Index", "Home"));
        }