Пример #1
0
        /// <summary>
        /// Add an new area for an <see cref="User"/> to the MongoDB
        /// </summary>
        /// <param name="areaName">The AREA's name to be created</param>
        /// <returns>A redirect to the "Index" action</returns>
        public ActionResult AddArea(string areaName)
        {
            string     name = "";
            DataAccess db   = DataAccess.Instance;

            if (User.Identity is ClaimsIdentity claimId)
            {
                name = claimId.FindFirst(ClaimTypes.NameIdentifier).Value;
                db.AddAreaToUser(name, areaName);
            }
            return(RedirectToAction("Index"));
        }