Exemplo n.º 1
0
        public ActionResult Index(FormCollection input)
        {
            var  IdArray               = input.GetValues("item.Id");
            var  NameArray             = input.GetValues("item.Name");
            var  ContentArray          = input.GetValues("item.Content");
            var  DepartmentIdArray     = input.GetValues("item.WebDepartmentId");
            var  ShortDescriptionArray = input.GetValues("item.ShortDescription");
            var  OrderArray            = input.GetValues("item.Order");
            long lanaguageId           = 1;
            var  LanguageIdArray       = input.GetValues("item.LanguageId");

            if (LanguageIdArray.Count() > 0)
            {
                lanaguageId = Convert.ToInt64(LanguageIdArray[0]);
            }

            for (int i = 0; i < IdArray.Count(); i++)
            {
                var Id     = Convert.ToInt64(IdArray[i]);
                var entity = _context.FindDetail <WebStory>(Id);
                entity.Name            = NameArray[i];
                entity.WebDepartmentId = Convert.ToInt64(DepartmentIdArray[i]);
                var content = ContentArray[i];
                entity.Image            = _context.GetImage(content, "staff");
                entity.Content          = content;
                entity.ShortDescription = ShortDescriptionArray[i];
                entity.UpdatedDate      = DateTime.Now;
                entity.Order            = int.Parse(OrderArray[i] == "" ? "5": OrderArray[i]);
            }
            _context.SaveChange();
            return(RedirectToAction <WebStoryController>(d => d.Index(lanaguageId)));
        }
Exemplo n.º 2
0
        public ActionResult Index(FormCollection input)
        {
            var IdArray      = input.GetValues("item.Id");
            var NameArray    = input.GetValues("item.Name");
            var ImageArray   = input.GetValues("item.Image");
            var ContentArray = input.GetValues("item.Content");
            var AddressArray = input.GetValues("item.Address");
            var DateArray    = input.GetValues("item.Date");
            var DuringArray  = input.GetValues("item.During");

            long lanaguageId = 1;

            for (int i = 0; i < IdArray.Count(); i++)
            {
                var Id     = Convert.ToInt64(IdArray[i]);
                var entity = _context.FindDetail <WebEvent>(Id);
                entity.Name    = NameArray[i];
                entity.Address = AddressArray[i];
                entity.Date    = Convert.ToDateTime(DateArray[i]);
                entity.During  = DuringArray[i];
                var content = ContentArray[i];
                entity.Image       = _context.GetImage(content, "event");
                entity.Content     = content;
                entity.UpdatedDate = DateTime.Now;
            }
            _context.SaveChange();
            return(RedirectToAction <WebEventController>(d => d.Index(lanaguageId)));
        }
Exemplo n.º 3
0
        public ActionResult Index(FormCollection input)
        {
            var IdArray               = input.GetValues("item.Id");
            var NameArray             = input.GetValues("item.Name");
            var ImageArray            = input.GetValues("item.Image");
            var ContentArray          = input.GetValues("item.Content");
            var DateArray             = input.GetValues("item.Date");
            var ShortDescriptionArray = input.GetValues("item.ShortDescription");

            var WebNewsTypeIdArray = input.GetValues("item.WebNewsTypeId");

            long lanaguageId     = 1;
            var  LanguageIdArray = input.GetValues("item.LanguageId");

            if (LanguageIdArray.Count() > 0)
            {
                lanaguageId = Convert.ToInt64(LanguageIdArray[0]);
            }

            for (int i = 0; i < IdArray.Count(); i++)
            {
                var Id     = Convert.ToInt64(IdArray[i]);
                var entity = _context.FindDetail <WebNews>(Id);
                entity.Name          = NameArray[i];
                entity.WebNewsTypeId = Convert.ToInt64(WebNewsTypeIdArray[i]);
                entity.Date          = Convert.ToDateTime(DateArray[i]);
                var content = ContentArray[i];
                entity.Image            = _context.GetImage(content, "news");
                entity.ShortDescription = ShortDescriptionArray[i];
                entity.Content          = content;
                entity.UpdatedDate      = DateTime.Now;
            }
            _context.SaveChange();
            return(RedirectToAction <WebNewsController>(d => d.Index(lanaguageId)));
        }