static void Main(string[] args) { IInstutionService instutionService = IstanceFactory.GetIstance <IInstutionService>(); try { Console.Write("Kurum Kodu: "); string code = Console.ReadLine(); Console.Write("Adı: "); string name = Console.ReadLine(); Console.Write("Tel: "); string tel = Console.ReadLine(); Console.Write("Email: "); string email = Console.ReadLine(); Console.Write("Adres: "); string adres = Console.ReadLine(); Console.Write("Web Site Adresi : "); string website = Console.ReadLine(); Console.Write("Açıklama: "); string aciklama = Console.ReadLine(); var result = instutionService.Add(new Institution { Code = code, Name = name, Tel01 = tel, Email = email, Address = adres, WebSite01 = website, Explanation = aciklama, UserId = 2 }); Console.WriteLine(result.sError); Console.ReadLine(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadLine(); } }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { // ... log stuff before execution if (System.Threading.Thread.CurrentPrincipal.Identity.IsAuthenticated == false) { filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary { { "controller", "Account" }, { "action", "Index" } }); return; } try { var authCookie = HttpContext.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie == null) { return; } var encTicket = authCookie.Value; if (string.IsNullOrEmpty(encTicket)) { return; } var ticket = FormsAuthentication.Decrypt(encTicket); var securityUtilies = new SecurityUtilities(); var identity = securityUtilies.FormsAuthTicketToIdentity(ticket); var principal = new GenericPrincipal(identity, identity.Roles); if (!string.IsNullOrEmpty(identity.Name) && !string.IsNullOrEmpty(identity.Email)) { IUserService userService = IstanceFactory.GetIstance <IUserService>(); var result = userService.GetByUserForId(identity.Id); if (result != null) { _BaseUser = new User { FirstName = result.FirstName, LastName = result.LastName, Email = identity.Email, Id = result.Id }; ViewBag.UserFirstName = _BaseUser.FirstName; ViewBag.UserLastName = _BaseUser.LastName; } } } catch (Exception) { } }