Exemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Id,Header,TextH,TextP")] AboutU aboutU, HttpPostedFileBase Image)
        {
            if (ModelState.IsValid)
            {
                if (Image == null)
                {
                    return(RedirectToAction("Create", "AboutUs"));
                }
                if (Extension.CheckImg(Image, Extension.MAxfileSize))
                {
                    try
                    {
                        aboutU.Image = Extension.SaveImg(Image, "~/Public2/images/about");
                    }
                    catch
                    {
                        return(View(aboutU));
                    }
                }
                else
                {
                    return(View(aboutU));
                }
                db.AboutUS.Add(aboutU);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aboutU));
        }
Exemplo n.º 2
0
        // GET: About
        public ActionResult Index()
        {
            YelCreativeEntities db = new YelCreativeEntities();
            AboutU         abt     = db.AboutUs.SingleOrDefault(x => x.Id_About == 1);
            AboutViewModel avm     = new AboutViewModel();

            avm.Id_About         = abt.Id_About;
            avm.Content_About    = abt.Content_About;
            avm.Update_Date      = abt.Update_Date;
            avm.Current_Position = abt.Current_Position;
            avm.Birthday         = abt.Birthday;
            avm.City             = abt.City;
            avm.Age    = abt.Age;
            avm.Degree = abt.Degree;

            if (Session["AdminID"] == null)
            {
                return(RedirectToAction("Auth"));
            }

            int id = Int32.Parse(Session["AdminId"].ToString());

            User usr = db.Users.SingleOrDefault(x => x.Id_User == id);

            ViewBag.AdminPhoto = usr.Image_Path;
            ViewBag.AdminName  = usr.Full_Name;

            return(View(avm));
        }
Exemplo n.º 3
0
        public ActionResult Edit([Bind(Include = "Id,Header,TextH,TextP")] AboutU aboutU, HttpPostedFileBase Image, string fileadi)
        {
            if (ModelState.IsValid)
            {
                if (Image != null)
                {
                    if (Extension.CheckImg(Image, Extension.MAxfileSize))
                    {
                        try
                        {
                            aboutU.Image = Extension.SaveImg(Image, "~/Public2/images/about");
                        }
                        catch
                        {
                            return(View(aboutU));
                        }
                    }
                    else
                    {
                        return(View(aboutU));
                    }
                }
                else
                {
                    aboutU.Image = fileadi;
                }

                db.Entry(aboutU).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(aboutU));
        }
Exemplo n.º 4
0
        public void Edit(AboutU model)
        {
            var toEdit = _db.AboutUs.FirstOrDefault();

            toEdit.AboutUsDescription = model.AboutUsDescription;

            _db.SaveChanges();
        }
Exemplo n.º 5
0
        public ActionResult DeleteConfirmed(int id)
        {
            AboutU aboutU = db.AboutUs.Find(id);

            db.AboutUs.Remove(aboutU);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "Id,title,Description,AboutImage,İconimg")] AboutU aboutU)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aboutU).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aboutU));
 }
Exemplo n.º 7
0
 public ActionResult Edit([Bind(Include = "Id,description,UrlImg,header,Icon")] AboutU aboutU)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aboutU).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aboutU));
 }
Exemplo n.º 8
0
        public ActionResult DeleteConfirmed(int id)
        {
            AboutU aboutU = db.AboutUS.Find(id);

            db.AboutUS.Remove(aboutU);
            db.SaveChanges();
            Extension.Deletimg("~/Public2/images/about", aboutU.Image);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 9
0
        public async Task <IActionResult> OnGetAsync()
        {
            AboutU = await _context.AboutUs.FirstOrDefaultAsync(m => m.Id == 1);

            if (AboutU == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemplo n.º 10
0
 public ActionResult Edit([Bind(Include = "about_id,about_header,about_text")] AboutU aboutU)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aboutU).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aboutU));
 }
Exemplo n.º 11
0
        public ActionResult Create([Bind(Include = "Id,description,UrlImg,header,Icon")] AboutU aboutU)
        {
            if (ModelState.IsValid)
            {
                db.AboutUs.Add(aboutU);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aboutU));
        }
Exemplo n.º 12
0
        public ActionResult Create([Bind(Include = "about_id,about_header,about_text")] AboutU aboutU)
        {
            if (ModelState.IsValid)
            {
                db.AboutUs.Add(aboutU);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(aboutU));
        }
Exemplo n.º 13
0
        // GET: Landing
        public ActionResult Index()
        {
            LandingViewMode landingVM = new LandingViewMode();

            //user
            user = db.Users.SingleOrDefault(x => x.Id_User == 1);
            landingVM.Full_Name  = user.Full_Name;
            landingVM.Image_Path = user.Image_Path;

            //about
            about = db.AboutUs.SingleOrDefault(x => x.Id_About == 1);
            landingVM.Id_About         = about.Id_About;
            landingVM.Content_About    = about.Content_About;
            landingVM.Current_Position = about.Current_Position;
            landingVM.Birthday         = about.Birthday;
            landingVM.City             = about.City;
            landingVM.Age    = about.Age;
            landingVM.Degree = about.Degree;

            //services
            List <Service> serviceList = db.Services.ToList();

            ViewBag.ServiceList = serviceList;

            //portofolio
            List <Portofolio> protoList = db.Portofolios.ToList();

            ViewBag.PorfoList = protoList;

            //category
            List <Category> CategList = db.Categories.ToList();

            ViewBag.CateList      = CategList;
            ViewBag.Category_Name = category.Category_Name;

            //contact us
            contact             = db.ContactUs.SingleOrDefault(x => x.Id_Contact == 1);
            landingVM.Address   = contact.Address;
            landingVM.Phone     = contact.Phone;
            landingVM.Email     = contact.Email;
            landingVM.Instagram = contact.Instagram;
            landingVM.Twitter   = contact.Twitter;
            landingVM.Facebook  = contact.Facebook;
            landingVM.Linkin    = contact.Linkin;

            //skill
            List <Skill> skillList = db.Skills.ToList();

            ViewBag.SkillList = skillList;

            return(View(landingVM));
        }
Exemplo n.º 14
0
        // GET: Dashboard/AdminAboutUs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AboutU aboutU = db.AboutUs.Find(id);

            if (aboutU == null)
            {
                return(HttpNotFound());
            }
            return(View(aboutU));
        }
Exemplo n.º 15
0
 public void BindValues()
 {
     try
     {
         AboutU objAbout = AboutUsController.GetAboutUsById(AboutUsId);
         txtDescp.Text   = objAbout.Description;
         txtHeading.Text = objAbout.heading;
         //if (objAbout.image != "")
         //    abtUsImg.ImageUrl = objAbout.image;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 16
0
        public ActionResult Index(AboutViewModel model)
        {
            YelCreativeEntities db = new YelCreativeEntities();

            if (ModelState.IsValid == true)
            {
                AboutU ab = db.AboutUs.SingleOrDefault(x => x.Id_About == model.Id_About);
                ab.Id_About      = model.Id_About;
                ab.Content_About = model.Content_About;
                ab.Update_Date   = DateTime.Now;
                db.SaveChanges();
            }
            var response = true;

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 17
0
 public AboutU InsertAboutUs(AboutU objAbout)
 {
     try
     {
         objAbout.isDeleted  = false;
         objAbout.insertDate = DateTime.Now;
         using (var context = new FitnessCenterEntities())
         {
             context.AboutUs.AddObject(objAbout);
             context.SaveChanges();
             return(objAbout);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 18
0
        public ActionResult UpdateAboutMe(AboutViewModel model)
        {
            YelCreativeEntities db = new YelCreativeEntities();

            AboutU ab = db.AboutUs.SingleOrDefault(x => x.Id_About == model.Id_About);

            ab.Current_Position = model.Current_Position;
            ab.City             = model.City;
            ab.Age      = model.Age;
            ab.Birthday = model.Birthday;
            ab.Degree   = model.Degree;

            db.SaveChanges();

            var response = true;

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 19
0
 public AboutU UpdateAboutUs(AboutU objAbout)
 {
     try
     {
         objAbout.updateDate = DateTime.Now;
         using (var context = new FitnessCenterEntities())
         {
             context.AboutUs.Attach(context.AboutUs.Single(x => x.ID == objAbout.ID));
             context.AboutUs.ApplyCurrentValues(objAbout);
             context.SaveChanges();
             return(objAbout);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 20
0
        public ActionResult Edit(AboutU about)
        {
            if (ModelState.IsValid)
            {
                var dao = new AboutUsDAO();

                bool result = dao.Update(about);
                if (result)
                {
                    SetAlert("Cập nhật mới thành công", "success");
                    return(RedirectToAction("Index", "AboutUs"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật không thành công ! ");
                }
            }
            return(View("Index"));
        }
Exemplo n.º 21
0
        public bool Update(AboutU entity)
        {
            try
            {
                var about = db.AboutUs.Find(entity.ID);
                about.Name = entity.Name;

                about.Description = entity.Description;
                about.Detail      = entity.Detail;

                about.CreatedBy = entity.CreatedBy;

                about.ModifileBy   = entity.ModifileBy;
                about.ModifileDate = DateTime.Now;
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 22
0
 public void UpdateAboutUs()
 {
     try
     {
         AboutU objAbout = AboutUsController.GetAboutUsById(AboutUsId);
         objAbout.heading     = txtHeading.Text;
         objAbout.Description = txtDescp.Text;
         //if (fileUpldImg.HasFile)
         //{
         //    string fileName = Path.GetFileName(fileUpldImg.FileName);
         //    string path = Server.MapPath("~/assets/assets/images/fitness/" + fileName);
         //    fileUpldImg.SaveAs(path);
         //    objAbout.image = "~/assets/assets/images/fitness/" + fileName;
         //}
         objAbout = new AboutUsController().UpdateAboutUs(objAbout);
         ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "succ_msg", "MessageBox('Success','Data Updated');", true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 23
0
 public long Insert(AboutU entity)
 {
     db.AboutUs.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
Exemplo n.º 24
0
 public ActionResult Edit(AboutU model)
 {
     aboutDataProvider.Edit(model);
     return(RedirectToAction("About", "Admin"));
 }