public IActionResult Login([FromServices] IAppLogCreator appLogCreator, [FromServices] IAppLogRetriever appLogRetriever, String username, String password) { IUser user = UserTypeFactory.CreateUser(username, password); if (user != null && user.GetType() == typeof(Administrator)) { Administrator AdminUser = (Administrator)user; AdminUser.IsLogin = true; _session = Session.getInstance; _session.setCurrentUser(AdminUser); new AdminMapper().Update(AdminUser).Save().Commit(); return(RedirectToAction("Profile", "Admin")); } else if (user != null && user.GetType() == typeof(Household)) { Household householduser = (Household)user; householduser.IsLogin = true; _session = Session.getInstance; _session.setCurrentUser(householduser); new HouseholdMapper().Update(householduser).Save().Commit(); appLogRetriever.SetHouseholdId(householduser._id); appLogCreator.SetHouseholdId(householduser._id); appLogCreator.AddLog(this, "ACTION*/-LOGIN", DateTime.Now); return(RedirectToAction("Profile", "Household")); } else { return(View("Index")); } }
// Constructor public ApplicationUsage(IAppLogRetriever ar) { appLogRetriever = ar; }
public ApplicationUsageController([FromServices] IAppLogCreator ac, [FromServices] IAppLogRetriever ar) { ac.PushLogs(); applicationUsage = new ApplicationUsage(ar); }