コード例 #1
0
        /// <summary>
        /// Login for user admin or scm
        /// </summary>
        /// <param name="idUser"></param>
        /// <param name="isAdmin"></param>
        /// <returns></returns>
        protected ActionResult LogInAdminSCM(int idUser, bool isAdmin)
        {
            //admin
            if (isAdmin)
            {
                AdminModel adminModel = DBConnection.GetAdmin(idUser);
                if (adminModel.PhotoBytes.Count() == 0)
                {
                    adminModel.Photo = adminModel.DefaultPhoto();
                }
                else
                {
                    adminModel.RenderImage();
                }

                TempData["admin"] = adminModel;
                return(RedirectToAction("Home", "AdminHome"));
            }
            //scm
            else
            {
                SCM scm = DBConnection.GetSCM(idUser);
                if (scm.PhotoBytes.Count() == 0)
                {
                    scm.Photo = scm.DefaultPhoto();
                }
                else
                {
                    scm.RenderImage();
                }
                TempData["scm"] = scm;
                return(RedirectToAction("Home", "SCMHome"));
            }
        }