Example #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            usertype usertype = db.usertype.Find(id);

            db.usertype.Remove(usertype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 internal static UserTypeModel ConvertToUsertypeModel(usertype item)
 {
     return(new UserTypeModel()
     {
         Id = item.Id,
         UserTypeName = item.UserTypeName,
         IsHorizontalMenu = item.IsHorizontalMenu,
     });
 }
        public async Task <DTOusertype> Postusertype(DTOusertype newDTO)
        {
            usertype newProd = EntityMapper.updateEntity(null, newDTO);

            db.usertypes.Add(newProd);
            await db.SaveChangesAsync();

            return(newDTO);
        }
        public async Task <IHttpActionResult> Putusertype(int ID, DTOusertype editedDTO)
        {
            usertype toUpdate = db.usertypes.Find(ID);

            toUpdate = EntityMapper.updateEntity(toUpdate, editedDTO);
            db.Entry(toUpdate).State = EntityState.Modified;
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #5
0
 public ActionResult Edit([Bind(Include = "id,description")] usertype usertype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(usertype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(usertype));
 }
Example #6
0
        public ActionResult Create([Bind(Include = "id,description")] usertype usertype)
        {
            if (ModelState.IsValid)
            {
                db.usertype.Add(usertype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(usertype));
        }
Example #7
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["last_name"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            usertype usertype = db.usertypes.Find(id);

            db.usertypes.Remove(usertype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #8
0
        public static usertype updateEntity(usertype entityObjct, DTOusertype dto)
        {
            if (entityObjct == null)
            {
                entityObjct = new usertype();
            }

            entityObjct.UserType_ID         = dto.UserType_ID;
            entityObjct.UserTypeDescription = dto.UserTypeDescription;

            return(entityObjct);
        }
Example #9
0
 public ActionResult Edit(usertype usertype)
 {
     if (string.IsNullOrEmpty(Convert.ToString(Session["last_name"])))
     {
         return(RedirectToAction("Login", "Home"));
     }
     if (ModelState.IsValid)
     {
         db.Entry(usertype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(usertype));
 }
Example #10
0
        // GET: Usertype/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            usertype usertype = db.usertype.Find(id);

            if (usertype == null)
            {
                return(HttpNotFound());
            }
            return(View(usertype));
        }
Example #11
0
        public ActionResult Create(usertype usertype)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["last_name"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (ModelState.IsValid)
            {
                db.usertypes.Add(usertype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(usertype));
        }
Example #12
0
        // GET: usertypes/Edit/5
        public ActionResult Edit(int?id)
        {
            if (string.IsNullOrEmpty(Convert.ToString(Session["last_name"])))
            {
                return(RedirectToAction("Login", "Home"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            usertype usertype = db.usertypes.Find(id);

            if (usertype == null)
            {
                return(HttpNotFound());
            }
            return(View(usertype));
        }
Example #13
0
 public ActionResult Index(usertype user)
 {
     if (user.Usertype == "Admin")
     {
         return(RedirectToAction("Index", "admin_Login"));
     }
     else if (user.Usertype == "Buyer")
     {
         return(RedirectToAction("Index", "ForBuyerHome"));
     }
     else if (user.Usertype == "Seller")
     {
         return(RedirectToAction("Login", "ForSellerAccount"));
     }
     else if (user.Usertype == "Professional")
     {
         return(RedirectToAction("Login", "ForProfessionalAccount"));
     }
     return(View(user));
 }
Example #14
0
        /// <summary>
        /// Logs the current user in SSO via the profile api
        /// </summary>
        /// <param name="userType">The type of user you want to log in as.</param>
        public void SignUserIntoSSOViaProfileAPI(usertype userType)
        {
            Assert.Fail("We nolonger support SSO login/Signin. Please rewrite your test to use identity!");

            // Check to see what type of user we are wanting to sign in as
            Console.WriteLine("SignUserIntoSSOViaProfileAPI");
            if (userType == usertype.NORMALUSER)
            {
                // Set the user to be the normal user
                SetCurrentUserNormal();
            }
            else if (userType == usertype.EDITOR)
            {
                // Set the user to be the editor
                SetCurrentUserEditor();
            }
            else if (userType == usertype.SUPERUSER)
            {
                // Set the user to be the super user
                SetCurrentUserSuperUser();
            }
            else if (userType == usertype.PROFILETEST)
            {
                // Set the user to be the profile test user
                SetCurrentUserProfileTest();
            }
            else if (userType == usertype.MODERATOR)
            {
                // Set the user to be the moderator test user
                SetCurrentUserModerator();
            }
            else if (userType == usertype.PREMODUSER)
            {
                // Set the user to be the premod test user
                SetCurrentUserPreModUser();
            }
            else if (userType == usertype.NOTABLE)
            {
                // Set the user to be the notable test user
                SetCurrentUserNotableUser();
            }
            else if (userType == usertype.IDENTITYTEST)
            {
                // Set the user to be the notable test user
                SetCurrentUserAsIdentityTestUser();
            }

            // Create the profile api obejct
            using (FullInputContext inputContext = new FullInputContext(""))
            {
                inputContext.GetCurrentSignInObject.SetService(_serviceName);
                inputContext.GetCurrentSignInObject.TrySetUserViaCookie(_cookie);
            }
        }
Example #15
0
        /// <summary>
        /// Logs the current user in via the SSO web service
        /// </summary>
        /// <returns></returns>
        public HttpWebResponse SignUserIntoSSOViaWebRequest(usertype userType)
        {
            // Check to see what type of user we are wanting to sign in as
            Console.WriteLine("SignUserIntoSSOViaWebRequest");
            if (userType == usertype.NORMALUSER)
            {
                // Set the user to be the normal user
                SetCurrentUserNormal();
            }
            else if (userType == usertype.EDITOR)
            {
                // Set the user to be the editor
                SetCurrentUserEditor();
            }
            else if (userType == usertype.SUPERUSER)
            {
                // Set the user to be the super user
                SetCurrentUserSuperUser();
            }
            else if (userType == usertype.PROFILETEST)
            {
                // Set the user to be the profile test user
                SetCurrentUserProfileTest();
            }
            else if (userType == usertype.MODERATOR)
            {
                // Set the user to be the moderator test user
                SetCurrentUserModerator();
            }
            else if (userType == usertype.PREMODUSER)
            {
                // Set the user to be the premod test user
                SetCurrentUserPreModUser();
            }
            else if (userType == usertype.NOTABLE)
            {
                // Set the user to be the notable test user
                SetCurrentUserNotableUser();
            }
            else if (userType == usertype.IDENTITYTEST)
            {
                // Set the user to be the notable test user
                SetCurrentUserAsIdentityTestUser();
            }

            // Set the url with the requested service anme and user details
            Uri URL = new Uri("http://ops-dev14.national.core.bbc.co.uk/cgi-perl/signon/mainscript.pl?service=" + _serviceName + "&c_login=login&username="******"&password="******"Signing in user ->");
                _response = (HttpWebResponse)webRequest.GetResponse();
                Console.WriteLine(" done");
            }
            catch (Exception ex)
            {
                // Problems!
                Console.WriteLine(" failed!");
                Assert.Fail("Web request ( " + webRequest.RequestUri + " ) failed with error : " + ex.Message);
                _response = null;
            }

            GetLastResponseAsString();

            return _response;
        }