예제 #1
0
        /// <summary>
        /// To Change Password
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool changepassword(LoginInfoData lidata)
        {
            crazyTattoosEntities data = new crazyTattoosEntities();
            loginInfo            li   = new loginInfo();
            bool ans = false;

            //Get loginInfo using old password
            li = (from l in data.loginInfoes where l.LoginInfoId == lidata.Userid where l.Password == lidata.Oldpassword select l).FirstOrDefault();
            if (li != null)
            {
                var info = from l in data.loginInfoes
                           where l.LoginInfoId == lidata.Userid
                           select l;
                foreach (loginInfo li1 in info)
                {
                    li1.Password = lidata.Password; //set new password for the same
                }
                ans = true;
            }
            else if (li == null)
            {
                ans = false;
            }
            data.SaveChanges(); // ans save the changes

            return(ans);
        }
예제 #2
0
        //Get one image Info
        public ImageInfo ViewPhoto1(int ImageID)
        {
            crazyTattoosEntities data = new crazyTattoosEntities();
            ImageInfo            i    = new ImageInfo();

            i = data.ImageInfoes.Single(c => c.ImageID == ImageID); // lamda expression
            return(i);
        }
예제 #3
0
        //Get one Banner info from the supplied bannerId
        public ImageSlider ViewPhoto1(int PhotoId)
        {
            crazyTattoosEntities data = new crazyTattoosEntities();

            ImageSlider bt = new ImageSlider();

            bt = data.ImageSliders.Single(c => c.PhotoId == PhotoId); // lamda expression
            return(bt);
        }
        //Get One Category Info
        public categoryInfo ViewCategory(int CategoryID)
        {
            crazyTattoosEntities data = new crazyTattoosEntities();

            categoryInfo bt = new categoryInfo();

            bt = data.categoryInfoes.Single(c => c.CategoryId == CategoryID); // lamda expression
            return(bt);
        }
        //Get one Testimonial
        public Testimonial ViewTestimonial(int ID)
        {
            crazyTattoosEntities data = new crazyTattoosEntities();

            Testimonial bt = new Testimonial();

            bt = data.Testimonials.Single(c => c.TestimonialId == ID); // lamda expression
            return(bt);
        }
예제 #6
0
        //Login Admin Panel Implementation
        public loginInfo login(LoginInfoData liData)
        {
            crazyTattoosEntities data = new crazyTattoosEntities();
            loginInfo            li   = new loginInfo();

            // linq query
            li = (from log in data.loginInfoes
                  where log.UserName == liData.Username & log.Password == liData.Password
                  select log).First();
            return(li);
        }
        // Add new Category
        public int AddCategory(CategoryInfoData Nidata)
        {
            crazyTattoosEntities apData = new crazyTattoosEntities();
            categoryInfo         data   = new categoryInfo();

            data.CategoryName = Nidata.CategoryName;

            apData.categoryInfoes.Add(data);
            int ans = apData.SaveChanges();

            return(ans);
        }
        // Add Testimonial
        public int AddTestimonial(TestimonialInfoData Nidata)
        {
            crazyTattoosEntities apData = new crazyTattoosEntities();
            Testimonial          data   = new Testimonial();

            data.CustomerName = Nidata.CustomerName;
            data.Testimonial1 = Nidata.Testimonial;

            apData.Testimonials.Add(data);
            int ans = apData.SaveChanges();

            return(ans);
        }
예제 #9
0
        public int AddPhoto(ImageInfoData idata)
        {
            crazyTattoosEntities apData = new crazyTattoosEntities();
            ImageInfo            data   = new ImageInfo();

            data.ImageName      = idata.ImageName;
            data.ImageExtension = idata.ImageName.Substring(idata.ImageName.LastIndexOf('.'));
            data.ImageSize      = idata.ImageSize;
            data.ImageType      = idata.ImageType;
            data.CategoryId     = idata.CategoryId;
            apData.ImageInfoes.Add(data);
            int ans = apData.SaveChanges();

            return(ans);
        }
예제 #10
0
        public int AddPhoto(HomeImageInfoData Bidata)
        {
            crazyTattoosEntities apData = new crazyTattoosEntities();
            ImageSlider          data   = new ImageSlider();

            data.PhotoName = Bidata.BannerName;
            data.ExtName   = Bidata.BannerName.Substring(Bidata.BannerName.LastIndexOf('.'));
            data.PhotoSize = Bidata.BannerSize;
            data.PhotoType = Bidata.BannerType;

            apData.ImageSliders.Add(data);
            int ans = apData.SaveChanges();

            return(ans);
        }
예제 #11
0
        //Update Category info
        public int UpdateCategory(CategoryInfoData data)
        {
            crazyTattoosEntities nidata = new crazyTattoosEntities();
            categoryInfo         ni     = new categoryInfo();

            var nsd = from p in nidata.categoryInfoes where p.CategoryId == data.CategoryId select p;

            foreach (categoryInfo nifo in nsd)
            {
                nifo.CategoryId   = data.CategoryId;
                nifo.CategoryName = data.CategoryName;
            }
            int ans = nidata.SaveChanges();

            return(ans);
        }
        //Update testimonial info
        public int UpdateTestimonial(TestimonialInfoData data)
        {
            crazyTattoosEntities nidata = new crazyTattoosEntities();
            Testimonial          ni     = new Testimonial();

            var nsd = from p in nidata.Testimonials where p.TestimonialId == data.TestimonialId select p;

            foreach (Testimonial nifo in nsd)
            {
                nifo.TestimonialId = data.TestimonialId;
                nifo.CustomerName  = data.CustomerName;
                nifo.Testimonial1  = data.Testimonial;
            }
            int ans = nidata.SaveChanges();

            return(ans);
        }