public async Task <IActionResult> Create([Bind("Id,DateTime,PersonId,BodyWeight,Waist,BodyFat")] PhysicalLog physicalLog)
        {
            if (ModelState.IsValid)
            {
                _context.Add(physicalLog);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(ListPhysicalLogs)));
            }
            ViewData["PersonId"] = new SelectList(_context.Set <Person>(), "Id", "FullName", physicalLog.PersonId);
            return(View(physicalLog));
        }
        public async Task <IActionResult> Create([Bind("Id,DateTime,PersonId,ImageId,LifeLogStatusId,GameId")] LifeLog lifeLog)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lifeLog);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["GameId"]   = new SelectList(_context.Set <Game>(), "Id", "GameNumber", lifeLog.GameId);
            ViewData["PersonId"] = new SelectList(_context.Set <Person>(), "Id", "FullName", lifeLog.PersonId);
            return(View(lifeLog));
        }
        public async Task <IActionResult> Create([Bind("ImageId,Title,ImageFile")] ImageModel imageModel)
        {
            if (ModelState.IsValid)
            {
                //Save image to wwwwroot/Image !
                string wwwwRootPath = _hostEnvironment.WebRootPath;
                string fileName     = Path.GetFileNameWithoutExtension(imageModel.ImageFile.FileName);
                string extension    = Path.GetExtension(imageModel.ImageFile.FileName);
                imageModel.ImageName = fileName = fileName + DateTime.Now.ToString("yymmssfff") + extension;
                string path = Path.Combine(wwwwRootPath + "/Image/", fileName);
                using (var fileStream = new FileStream(path, FileMode.Create))
                {
                    await imageModel.ImageFile.CopyToAsync(fileStream);
                }
                //Insert record !
                _context.Add(imageModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(imageModel));
        }