public ActionResult DeactivateMember(int?id)
        {
            var   Emailid = User.Identity.Name.ToString();
            Users user    = objNotesEntities.Users.Where(x => x.EmailId == Emailid).FirstOrDefault();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Users users = objNotesEntities.Users.Find(id);

            users.IsActive = false;
            objNotesEntities.Entry(users).State = EntityState.Modified;
            objNotesEntities.SaveChanges();

            var userid = users.ID;

            var notes = objNotesEntities.SellerNotes.Where(x => x.SellerID == userid);

            foreach (var item in notes)
            {
                item.Status       = objNotesEntities.ReferenceData.Where(x => x.RefCategory == "Note Status" && x.Value.ToLower() == "removed").Select(x => x.ID).FirstOrDefault();
                item.ActionedBy   = user.ID;
                item.ModifiedBy   = user.ID;
                item.ModifiedDate = DateTime.Now;
                item.AdminRemarks = null;
                objNotesEntities.Entry(item).State = EntityState.Modified;
            }
            objNotesEntities.SaveChanges();

            TempData["Deactivate"] = users.FirstName + " " + users.LastName;
            TempData["Message"]    = "Deactivate Successfully !";

            return(RedirectToAction("MembersAdmin", "Admin"));
        }
Ejemplo n.º 2
0
        public ActionResult Approve(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var   Emailid = User.Identity.Name.ToString();
            Users user    = objNotesEntities.Users.Where(x => x.EmailId == Emailid).FirstOrDefault();

            SellerNotes note = objNotesEntities.SellerNotes.Find(id);

            if (note == null)
            {
                return(HttpNotFound());
            }

            note.Status        = objNotesEntities.ReferenceData.Where(x => x.RefCategory == "Note Status" && x.Value == "Published").Select(x => x.ID).FirstOrDefault();
            note.ModifiedBy    = user.ID;
            note.ModifiedDate  = DateTime.Now;
            note.ActionedBy    = user.ID;
            note.PublishedDate = DateTime.Now;
            objNotesEntities.Entry(note).State = EntityState.Modified;
            objNotesEntities.SaveChanges();

            return(RedirectToAction("NotesUnderReview", "Admin"));
        }
Ejemplo n.º 3
0
        public ActionResult EditAdministrator(int?id, EditAdministrator addadministrator)
        {
            if (ModelState.IsValid)
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                Users       admin        = objNotesEntities.Users.Find(id);
                UserProfile adminprofile = objNotesEntities.UserProfile.Where(x => x.UserID == admin.ID).FirstOrDefault();
                if (admin == null)
                {
                    return(RedirectToAction("Error", "HomePage"));
                }

                var   Emailid = User.Identity.Name.ToString();
                Users userObj = objNotesEntities.Users.Where(x => x.EmailId == Emailid).FirstOrDefault();

                admin.FirstName    = addadministrator.FirstName;
                admin.LastName     = addadministrator.LastName;
                admin.EmailId      = addadministrator.EmailID;
                admin.ModifiedBy   = userObj.ID;
                admin.ModifiedDate = DateTime.Now;

                objNotesEntities.Entry(admin).State = EntityState.Modified;
                objNotesEntities.SaveChanges();

                adminprofile.PhoneCountryCode = addadministrator.PhoneNumberCountryCode;
                adminprofile.PhoneNumber      = addadministrator.PhoneNumber;

                objNotesEntities.Entry(adminprofile).State = EntityState.Modified;
                objNotesEntities.SaveChanges();

                TempData["AddAdministrator"] = userObj.FirstName + " " + userObj.LastName;
                TempData["Message"]          = "Administrator has been Successfully Edited !";
                return(RedirectToAction("Administrators", "Admin"));
            }
            return(View());
        }