Example #1
0
        public Slot[] Get(int dayId)
        {
            string type   = this.Request.Method;
            string userID = HttpContext.User.FindFirstValue(ClaimTypes.Email);
            string source = this.Request.Path;
            string param1 = "none";
            string param2 = "none";
            string param3 = "none";

            dbLogger.Log(userID, type, source, param1, param2, param3);

            List <Slot> slots = ds.GetAllSlotsByDayId(dayId);

            Slot[] slotArray = new Slot[slots.Count];
            for (int i = 0; i < slots.Count; i++)
            {
                slotArray[i] = slots[i];
            }
            return(slotArray);
        }
Example #2
0
        public Day[] GetDaysByScheduleId(int scheduleId)
        {
            string type   = this.Request.Method;
            string userID = HttpContext.User.FindFirstValue(ClaimTypes.Email);
            string source = this.Request.Path;
            string param1 = "none";
            string param2 = "none";
            string param3 = "none";

            dbLogger.Log(userID, type, source, param1, param2, param3);

            List <Day> days = ds.GetAllDaysByScheduleId(scheduleId);

            Day[] dayArray = new Day[days.Count];
            for (int i = 0; i < days.Count; i++)
            {
                dayArray[i] = days[i];
            }
            return(dayArray);
        }
        public IEnumerable <Chore> GetTasksByUser(string userId)
        {
            string type   = this.Request.Method;
            string userID = HttpContext.User.FindFirstValue(ClaimTypes.Email);
            string source = this.Request.Path;
            string param1 = "none";
            string param2 = "none";
            string param3 = "none";

            dbLogger.Log(userID, type, source, param1, param2, param3);

            List <Chore> tasks = ds.GetAllTasksByUser(userId);

            Chore[] taskArray = new Chore[tasks.Count];
            for (int i = 0; i < tasks.Count; i++)
            {
                taskArray[i] = tasks[i];
            }

            return(taskArray);
        }
Example #4
0
        public IEnumerable <Schedule> Get()
        {
            string type   = this.Request.Method;
            string userID = HttpContext.User.FindFirstValue(ClaimTypes.Email);
            string source = this.Request.Path;
            string param1 = "none";
            string param2 = "none";
            string param3 = "none";

            dbLogger.Log(userID, type, source, param1, param2, param3);

            List <Schedule> schedules = ds.GetAllSchedules();

            Schedule[] scheduleArray = new Schedule[schedules.Count];
            for (int i = 0; i < schedules.Count; i++)
            {
                scheduleArray[i] = schedules[i];
            }

            return(scheduleArray);
        }
        public async Task <ActionResult> Login([FromForm] string userId, [FromForm] string password)
        {
            User   user     = ds.GetUser(userId);
            string Password = user.Password;

            if (Password == password)
            {
                var claims = new List <Claim> {
                    new Claim(ClaimTypes.Email, userId)
                };
                var claimsIdentity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
                var authProperties = new AuthenticationProperties
                {
                    //AllowRefresh = <bool>,
                    // Refreshing the authentication session should be allowed.

                    //ExpiresUtc = DateTimeOffset.UtcNow.AddMinutes(10),
                    // The time at which the authentication ticket expires. A
                    // value set here overrides the ExpireTimeSpan option of
                    // CookieAuthenticationOptions set with AddCookie.

                    //IsPersistent = true,
                    // Whether the authentication session is persisted across
                    // multiple requests. When used with cookies, controls
                    // whether the cookie's lifetime is absolute (matching the
                    // lifetime of the authentication ticket) or session-based.

                    //IssuedUtc = <DateTimeOffset>,
                    // The time at which the authentication ticket was issued.

                    //RedirectUri = <string>
                    // The full path or absolute URI to be used as an http
                    // redirect response value.
                };
                await HttpContext.SignInAsync(
                    CookieAuthenticationDefaults.AuthenticationScheme,
                    new ClaimsPrincipal(claimsIdentity),
                    authProperties);

                string type   = this.Request.Method;
                string userID = userId;
                string source = this.Request.Path;
                string param1 = "userId = " + userId;
                string param2 = "password = "******"none";
                dbLogger.Log(userID, type, source, param1, param2, param3);

                user.Password = "";
                return(Json(user));
            }
            else
            {
                string type   = this.Request.Method;
                string userID = userId;
                string source = this.Request.Path;
                string param1 = "userId = " + userId;
                string param2 = "password = "******"none";
                dbLogger.Log(userID, type, source, param1, param2, param3);

                user.UserId = "*****@*****.**";
                return(Json(user));
            }
        }