コード例 #1
0
        public ActionResult AddInfo(int meh = 0)
        {
            var vm = new AddInfoVM
            {
                SelectedCategoryId = 0,
                Categories         = getHtmlCategories(),
                Places             = getPlacesForAddInfo(meh),
            };

            return(View(vm));
        }
コード例 #2
0
        public ActionResult AddInfo(AddInfoVM vm)
        {
            var ie = new InfoEntity
            {
                categoryId = vm.SelectedCategoryId,
                content    = vm.Content,
                time       = vm.StartTime,
                endTime    = vm.EndTime,
                userId     = (Session["user"] as UserEntity).Id,
                placeId    = vm.PlaceId,
            };
            var infoService = ServiceFactory.getInfoServices();
            var id          = infoService.NewInfo(ie);

            return(RedirectToAction(nameof(InfoDetails), new { id = id, placeId = vm.PlaceId }));
        }