Example #1
0
        public ActionResult Create()
        {
            //ViewBag.HelloName = "Hello " + User.Identity.GetUserId();
            //var userID = User.Identity.GetUserId();
            //ViewBag.CurrentUser = userID;

            var viewmodelObj = new CreateThingFormViewModel
            {
                ThingCatListable = _context.ThingCategoryTBLs.ToList()
            };

            return(View(viewmodelObj));
        }
Example #2
0
        public ActionResult Create(CreateThingFormViewModel vmObj)
        {
            if (!ModelState.IsValid)
            {
                return(View(vmObj));
            }
            var thingObj = new ThingTBL
            {
                ThinkerId          = User.Identity.GetUserId(),
                ThingName          = vmObj.ThingNameVM,
                ThingCatThingCatID = vmObj.ThingCatIDVM,
                ThoughtName        = vmObj.ThoughtNameVM,
            };

            _context.ThingTBLs.Add(thingObj);
            _context.SaveChanges();

            return(RedirectToAction("Index", "home"));
        }