public ActionResult ConfirmChangePassword(string oldpass, string Pass, string cpass)
        {
            MDirectorRepository orepo = new MDirectorRepository();
            LoginRepository     lrepo = new LoginRepository();

            MDirector of = orepo.Get(Convert.ToInt32(Session["Id"]));

            Logininfo log = lrepo.Get(Session["Name"].ToString());

            if (Session["Password"].ToString() == oldpass)
            {
                if (Pass != cpass)
                {
                    ViewData["Message"] = "Password Didn't match";
                }
                else
                {
                    of.MD_password     = Pass;
                    log.Login_Password = Pass;

                    orepo.Update(of);
                    lrepo.Update(log);

                    ViewData["Message"] = "Password Updated Successfully";
                    Session["MD"]       = of;
                    Session["Password"] = Pass;
                }
            }
            else
            {
                ViewData["Message"] = "Wrong Password";
            }

            return(View("Empty"));
        }
        public int Delete(string MD_name)
        {
            MDirector MDirectorToDelete = context.MDirectors.SingleOrDefault(d => d.MD_name == MD_name);

            context.MDirectors.Remove(MDirectorToDelete);
            return(context.SaveChanges());
        }
Esempio n. 3
0
        public MDirector bringMD(string id)
        {
            MDirectorRepository repo = new MDirectorRepository();
            MDirector           data = repo.Get(Convert.ToInt32(id));

            return(data);
        }
        public int Delete(int id)
        {
            MDirector MDirectorToDelete = context.MDirectors.SingleOrDefault(d => d.MD_Id == id);

            context.MDirectors.Remove(MDirectorToDelete);
            return(context.SaveChanges());
        }
        // GET: MD
        public ActionResult Home(MDirector ho)
        {
            Session["MD"]       = ho;
            Session["Id"]       = ho.MD_Id;
            Session["Name"]     = ho.MD_name;
            Session["Password"] = ho.MD_password;

            return(RedirectToAction("HomePage"));
        }
        public ActionResult ConfirmEditProfile(MDirector md)
        {
            MDirectorRepository mrepo = new MDirectorRepository();

            mrepo.Update(md);

            ViewData["Message"] = "Edit Successfull";
            Session["MD"]       = md;
            return(View("Empty"));
        }
        public int Update(MDirector MDirector)
        {
            MDirector MDirectorToUpdate = context.MDirectors.SingleOrDefault(d => d.MD_Id == MDirector.MD_Id);

            MDirectorToUpdate.MD_name     = MDirector.MD_name;
            MDirectorToUpdate.MD_password = MDirector.MD_password;
            MDirectorToUpdate.MD_address  = MDirector.MD_address;
            MDirectorToUpdate.MD_mobile   = MDirector.MD_mobile;
            return(context.SaveChanges());
        }
 public IHttpActionResult Post(MDirector mDirector)
 {
     if (lrepo.Get(mDirector.MD_name) == null)
     {
         this.mrepo.Insert(mDirector);
         string uri = Url.Link("GetUserById", new { id = mDirector.MD_Id });
         return(Created("GetCategoryById", mDirector));
     }
     else
     {
         return(StatusCode(HttpStatusCode.Forbidden));
     }
 }
        public int Insert(MDirector MDirector)
        {
            Logininfo li = new Logininfo();

            li.Login_acc_no   = context.MDirectors.Count() + 1;
            li.Login_Name     = MDirector.MD_name;
            li.Login_Password = MDirector.MD_password;
            li.Login_type     = "MD";
            context.Logininfos.Add(li);

            context.MDirectors.Add(MDirector);
            return(context.SaveChanges());
        }
        public IHttpActionResult Get(int MD_Id)
        {
            List <MDirector> ul = new List <MDirector>();
            MDirector        u  = new MDirector();

            u = this.mrepo.Get(MD_Id);
            ul.Add(u);

            if (u == null)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(Ok(ul));
            }
        }
Esempio n. 11
0
        public ActionResult ConfirmAddMD(MDirector md)
        {
            LoginRepository lrepo = new LoginRepository();

            if (lrepo.Get(md.MD_name) == null)
            {
                MDirectorRepository repo = new MDirectorRepository();
                repo.Insert(md);
                ViewData["Message"] = "MD inserted successfully";
            }
            else
            {
                ViewData["Message"] = "Username In User";
            }

            return(View("Empty"));
        }
        public int Update(MDirector MDirector)
        {
            MDirector MDirectorToUpdate = context.MDirectors.SingleOrDefault(d => d.MD_Id == MDirector.MD_Id);

            MDirectorToUpdate.MD_name     = MDirector.MD_name;
            MDirectorToUpdate.MD_password = MDirector.MD_password;
            MDirectorToUpdate.MD_address  = MDirector.MD_address;
            MDirectorToUpdate.MD_mobile   = MDirector.MD_mobile;
            MDirectorToUpdate.MD_Salary   = MDirector.MD_Salary;
            MDirectorToUpdate.MD_mobile   = MDirector.MD_mobile;

            LoginRepository lrepo = new LoginRepository();
            Logininfo       li    = lrepo.Get(MDirector.MD_name);

            li.Login_Password = MDirector.MD_password;
            lrepo.Update(li);

            return(context.SaveChanges());
        }
 public IHttpActionResult Put(MDirector mDirector)
 {
     this.mrepo.Update(mDirector);
     return(Ok(mDirector));
 }