示例#1
0
        public ActionResult ChangePasswordd(string oldpassword, string newpassword, string confirmnewpassword)
        {
            var admin = db.Person.FirstOrDefault();

            if (oldpassword == admin.Password)
            {
                ViewBag.PreviousPassword = "******";
                if (newpassword != confirmnewpassword)
                {
                    TempData["Confirm"] = "Passwords are not the same!!!";
                    return(RedirectToAction("ChangePassword", "Admin"));
                }
                else
                {
                    admin.Password        = confirmnewpassword;
                    db.Entry(admin).State = System.Data.Entity.EntityState.Modified;
                    db.SaveChanges();
                    TempData["Confirm"] = "You have already changed the password";

                    return(RedirectToAction("LoginPart", "Admin"));
                }
            }
            else
            {
                TempData["OldPassword"] = "******";
                return(RedirectToAction("ChangePassword", "Admin"));
            }
        }
        // GET: Admin/Contacts/Details/5
        public ActionResult Answer(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Contact contact = db.Contact.Find(id);

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

            if (!contact.isRead == true)
            {
                contact.isRead          = true;
                db.Entry(contact).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(contact, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public ActionResult saveEditBioAndSkill(int?id, string yourdescription,
                                                int skilllevel, bool displayastag, bool displayasbar, string skilldescription,
                                                int?categorie, int?typeoffskills)
        {
            var skill    = db.Skills.Find(id);
            var category = db.Category.Find(categorie);
            var skillss  = db.TypeOfSkill.Find(typeoffskills);

            if (category == null || typeoffskills == null)
            {
                return(Json("nullCategoryAndSkill", JsonRequestBehavior.AllowGet));
            }
            skill.YourDescription  = yourdescription;
            skill.DisplayAsTag     = displayasbar;
            skill.DisplayAsTag     = displayastag;
            skill.SkillDescription = skilldescription;
            skill.Category         = category.Name;
            skill.SkillLevel       = skilllevel;
            skill.TypeOfSkill      = skillss.Name;
            skill.ModifiedDate     = DateTime.Now;
            db.Entry(skill).State  = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
            return(PartialView("~/Areas/Admin/Views/Shared/PartialViews/BioAndSkillList.cshtml", db.Skills.Where(w => w.DeletedDate == null).ToList()));
        }