Beispiel #1
0
        public ActionResult About()
        {
            AboutModel model = new AboutModel();

            model.Message = model.GetAccessTokenAsync().Result;
            return(View(model));
        }
Beispiel #2
0
        public ActionResult About(AboutModel model)
        {
            var result = bll.GetProducersCountByConcreteMark(model.ConcreteMark);

            model.Quantity = result;
            return(View(model));
        }
Beispiel #3
0
        public IActionResult About()
        {
            var about = db.Abouts.ToList();

            Models.Objects.About a = new Models.Objects.About();
            if (about.Count == 0)
            {
                about = new List <Models.Objects.About>();
            }
            else
            {
                a = about.OrderByDescending(o => o.Id).FirstOrDefault();
            }
            var cont = db.Contacts.ToList();

            Models.Objects.Contact c = new Models.Objects.Contact();
            if (cont.Count != 0)
            {
                c = cont.OrderByDescending(c => c.Id).First();
            }
            var aboutModel = new AboutModel()
            {
                Abouts     = a,
                Categories = db.Categories.ToList(),
                Contacts   = c
            };

            return(View("About", aboutModel));
        }
Beispiel #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Title,Text")] AboutModel aboutModel)
        {
            if (id != aboutModel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aboutModel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AboutModelExists(aboutModel.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(aboutModel));
        }
Beispiel #5
0
        void OnGet()
        {
            var model = new AboutModel();

            model.OnGet();
            Assert.Equal("Your application description page.", model.Message);
        }
Beispiel #6
0
 public ActionResult aboutForm(AboutModel model)
 {
     // if (ModelState.IsValid)
     //  {
     return(PartialView());
     // }
 }
        public IActionResult Edit(AboutModel model)
        {
            var about = _mapper.Map <AboutModel, AboutUs>(model);

            if (model == null)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                var updateAbout = _aboutRepository.GetAboutById(model.Id);

                updateAbout.ModifiedBy   = _admin.Name;
                updateAbout.ModifiedDate = DateTime.Now;
                if (model.File == null)
                {
                    about.Image = updateAbout.Image;
                }
                else
                {
                    about.Image = _fileManager.Upload(model.File);
                }



                _aboutRepository.UpdateAbout(updateAbout, about);

                return(RedirectToAction("index"));
            }
            return(View(model));
        }
Beispiel #8
0
        public async Task <IActionResult> AboutUpdate(AboutModel model, IFormFile file)
        {
            if (ModelState.IsValid)
            {
                var entity = _aboutRepository.GetById(model.AboutId);
                if (entity == null)
                {
                    return(NotFound());
                }
                entity.AboutId     = model.AboutId;
                entity.Title       = model.Title;
                entity.Description = model.Description;
                entity.FullName    = model.FullName;
                entity.Website     = model.Website;
                entity.Email       = model.Email;
                entity.BirthDay    = model.BirthDay;
                entity.Job         = model.Job;
                if (file != null)
                {
                    var extention  = Path.GetExtension(file.FileName);
                    var randomName = string.Format($"{Guid.NewGuid()}{extention}");
                    entity.Image = randomName;
                    var path = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\images", randomName);

                    using (var stream = new FileStream(path, FileMode.Create))
                    {
                        await file.CopyToAsync(stream);
                    }
                }
                _aboutRepository.Update(entity);
                return(RedirectToAction("aboutlist"));
            }
            return(View(model));
        }
Beispiel #9
0
 /// <summary>
 /// Get item
 /// </summary>
 /// <param name="model">About model</param>
 /// <returns>AboutModel</returns>
 public AboutModel GetItemByID(AboutModel model)
 {
     try
     {
         using (var _context = new TDHEntities())
         {
             WEB_ABOUT _md = _context.WEB_ABOUT.FirstOrDefault(m => !m.deleted);
             if (_md == null)
             {
                 _md = new WEB_ABOUT()
                 {
                     id                   = Guid.NewGuid(),
                     content              = "",
                     link                 = "",
                     image                = "",
                     meta_title           = "",
                     meta_description     = "",
                     meta_keywords        = "",
                     meta_article_name    = "",
                     meta_article_publish = DateTime.Now,
                     meta_article_section = "",
                     meta_article_tag     = "",
                     meta_next            = "",
                     meta_og_image        = "",
                     meta_og_site_name    = "",
                     meta_twitter_image   = "",
                     create_by            = model.CreateBy,
                     create_date          = DateTime.Now,
                     deleted              = false,
                 };
                 _context.WEB_ABOUT.Add(_md);
                 _context.Entry(_md).State = EntityState.Added;
                 _context.SaveChanges();
             }
             return(new AboutModel()
             {
                 ID = _md.id,
                 Content = _md.content,
                 Link = _md.link,
                 Image = _md.image,
                 MetaTitle = _md.meta_title,
                 MetaDescription = _md.meta_description,
                 MetaKeywords = _md.meta_keywords,
                 MetaNext = _md.meta_next,
                 MetaOgSiteName = _md.meta_og_site_name,
                 MetaOgImage = _md.meta_og_image,
                 MetaTwitterImage = _md.meta_twitter_image,
                 MetaArticleName = _md.meta_article_name,
                 MetaArticleTag = _md.meta_article_tag,
                 MetaArticleSection = _md.meta_article_section,
                 MetaArticlePublish = _md.meta_article_publish,
                 Insert = false
             });
         }
     }
     catch (Exception ex)
     {
         throw new ServiceException(FILE_NAME, "GetItemByID", model.CreateBy, ex);
     }
 }
Beispiel #10
0
        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";
            var model = new AboutModel();

            return(View(model));
        }
Beispiel #11
0
        public JsonResult Index(AboutModel model)
        {
            try
            {
                #region " [ Declaration ] "

                AboutService _service = new AboutService();

                #endregion

                #region " [ Main process ] "

                model.CreateBy   = UserID;
                model.UpdateBy   = UserID;
                model.CreateDate = DateTime.Now;
                model.UpdateDate = DateTime.Now;

                #endregion

                //Call to service
                return(this.Json(_service.Save(model), JsonRequestBehavior.AllowGet));
            }
            catch (ServiceException serviceEx)
            {
                throw serviceEx;
            }
            catch (DataAccessException accessEx)
            {
                throw accessEx;
            }
            catch (Exception ex)
            {
                throw new ControllerException(FILE_NAME, "Index", UserID, ex);
            }
        }
Beispiel #12
0
        public void OnGet_IfValidModel_ReturnPage()
        {
            var pageModel = new AboutModel();
            var result    = pageModel.OnGet();

            Assert.IsType <PageResult>(result);
        }
Beispiel #13
0
        public ActionResult aboutView(AboutModel aboutobj)
        {
            AboutModel about  = new AboutModel();
            string     result = about.insertAboutView(aboutobj);

            return(View());
        }
Beispiel #14
0
        public ViewResult About()
        {
            var khoa = new AboutModel()
            {
                Firstname = "Khoa",
                Lastname  = "Nguyen",
                Email     = "*****@*****.**",
                Address   = "28 Nguyen Tri Phuong"
            };
            var tan = new AboutModel()
            {
                Firstname = "Tan",
                Lastname  = "Ton",
                Email     = "*****@*****.**",
                Address   = "28 Nguyen Tri Phuong"
            };
            var huy = new AboutModel()
            {
                Firstname = "Huy",
                Lastname  = "Phan",
                Email     = "*****@*****.**",
                Address   = "28 Nguyen Tri Phuong"
            };
            List <AboutModel> models = new List <AboutModel>();

            models.Add(khoa);
            models.Add(tan);
            models.Add(huy);

            ViewBag.Title = "About";
            return(View(models));
        }
Beispiel #15
0
        public IActionResult AboutUpdate(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var entity = _aboutRepository.GetById((int)id);

            if (entity == null)
            {
                return(NotFound());
            }
            var model = new AboutModel()
            {
                AboutId     = entity.AboutId,
                Title       = entity.Title,
                Description = entity.Description,
                Image       = entity.Image,
                FullName    = entity.FullName,
                Website     = entity.Website,
                Email       = entity.Email,
                BirthDay    = entity.BirthDay,
                Job         = entity.Job
            };

            return(View(model));
        }
Beispiel #16
0
        public ActionResult About()
        {
            var model = new AboutModel();

            model.name     = "Rodolfo";
            model.location = "Chihuahua, Chih. México.";
            return(View(model));
        }
Beispiel #17
0
        public ActionResult About()
        {
            var model = new AboutModel();

            model.Name     = "Lamuel";
            model.Location = "Wisconsin, USA";
            return(View(model));
        }
        public ActionResult About()
        {
            var model = new AboutModel();

            model.Name     = "Mehmet";
            model.Location = "KKTC";
            return(View(model));
        }
        public ActionResult About()
        {
            var model = new AboutModel();

            model.Name     = "Marko";
            model.Location = "Skopje, Macedonia";
            return(View(model));
        }
        /// <summary>
        /// Shows the about window.
        /// </summary>
        public void ShowAboutWindow()
        {
            var model = new AboutModel(Assembly.GetExecutingAssembly());

            WindowManager.ShowDialog <AboutView>(new AboutViewModel {
                Model = model
            });
        }
Beispiel #21
0
        public ActionResult About()
        {
            var model = new AboutModel();

            model.Name     = "Victor";
            model.Location = "Skövde";
            return(View(model));
        }
Beispiel #22
0
 public AboutDialog(int tab_index = 0)
 {
     InitializeComponent();
     DataContext = new AboutModel()
     {
         TabIndex = tab_index
     };
 }
        public ActionResult About()
        {
            var model = new AboutModel();
            model.Name = "Greg";
            model.Location = "Rochester, NY, USA";

            return View(model);
        }
        public ActionResult About()
        {
           var model = new AboutModel();
           model.Name = "Sheldon";
           model.Location = "Mobile, Alabama";

            return View(model );
        }
Beispiel #25
0
        public ActionResult About()
        {
            var model = new AboutModel();

            model.Name     = "Shad";
            model.Location = "Redmond";
            return(View(model));
        }
Beispiel #26
0
        public ActionResult About()
        {
            var model = new AboutModel();

            model.Name     = "Anthony";
            model.Location = "Surrey, UK";
            return(View(model));
        }
Beispiel #27
0
        public ActionResult About()
        {
            var model = new AboutModel();

            model.Name     = "Carter Mitchell";
            model.Location = "Illinois, USA";
            return(View(model));
        }
        public ActionResult About()
        {
            AboutModel model = new AboutModel {
                Name = "Mark", Location = "Belfast"
            };

            return(View(model));
        }
Beispiel #29
0
        public ActionResult About()
        {
            var model = new AboutModel();

            model.Name     = "Akshay Potdar";
            model.Location = "Pune";
            return(View(model));
        }
Beispiel #30
0
        /// <summary>
        /// 点击菜单项:关于,打开关于对话框
        /// </summary>
        private void About()
        {
            var model = new AboutModel();
            var view  = model.view;

            SubCloseEvent(view, true);
            view.ShowDialog();
        }
Beispiel #31
0
        public void SetMessagesInAboutPagesIsValid()
        {
            var about = new AboutModel();

            about.Message = "This is New!";
            Assert.IsNotNull(about.Message);
            Assert.AreEqual(about.Message, "This is New!");
        }
Beispiel #32
0
 public ActionResult Create(AboutView pNewAboutView)
 {
     About pNewAbout = new About();
     try
     {
         pNewAbout.Name = pNewAboutView.Name;
         pNewAbout.Descritp = pNewAboutView.Descritp;
         pNewAbout.Content = pNewAboutView.Content;
         pNewAbout.OrderDisplay = pNewAboutView.OrderDisplay;
         pNewAbout.Image = pNewAboutView.Image;
         pNewAbout.IsActive = pNewAboutView.IsActive;
         if(pNewAboutView.LangId=="Tiếng Việt")
         {
             pNewAbout.LangId = 0;
         }
         else
         {
             pNewAbout.LangId = 1;
         }
         pNewAbout.CreatedBy = account.Id;
         pNewAbout.CreatedDate = DateTime.Now;
         pNewAbout.EditBy = account.Id;
         pNewAbout.EditDate = DateTime.Now;
         var check = new AboutModel().Create(pNewAbout);
         if(check==true)
         {
             return RedirectToAction("Index");
         }
         else
         {
             return View(pNewAboutView);
         }
     }
     catch
     {
         return View(pNewAboutView);
     }
 }
 public AboutViewModel(AboutModel model, IDefaultMessenger defaultMessenger, 
                       IExtNavigationService navigationService, IExtDialogService dialogService) 
      : base(defaultMessenger, model, navigationService, dialogService)
 { }
Beispiel #34
0
 public ActionResult Edit(int id)
 {
     var pNewAboutView = new AboutView();
     var Object = new AboutModel().GetAboutById(id);
     pNewAboutView.Name = Object.Name;
     pNewAboutView.Descritp = Object.Descritp;
     pNewAboutView.Content = Object.Content;
     pNewAboutView.OrderDisplay = Object.OrderDisplay;
     pNewAboutView.IsActive = Object.IsActive;
     pNewAboutView.Image = Object.Image;
     if (Object.LangId == 0)
     {
         pNewAboutView.LangId = "Tiếng Việt";
     }
     else
     {
         pNewAboutView.LangId = "Tiếng Anh";
     }
     return View(pNewAboutView);
 }
Beispiel #35
0
 public ActionResult Delete(int id, About pNewAbout)
 {
     try
     {
         // TODO: Add delete logic here
         var check = new AboutModel().Delete(id);
         if(check==true)
         {
             return RedirectToAction("Index");
         }
         else
         {
             return View(pNewAbout);
         }
     }
     catch
     {
         return View(pNewAbout);
     }
 }
Beispiel #36
0
 public AboutWindow()
     : base(400, 300, 400, 300)
 {
     InitializeComponent();
     DataContext = new AboutModel();
 }