public async Task <IActionResult> Edit(Grounddto ground)
        {
            if (ModelState.IsValid)
            {
                //var directory = Path.Combine(_hosting.WebRootPath, "Home", "images", "Ground");
                //if (!Directory.Exists(directory))
                //    Directory.CreateDirectory(directory);
                //if (ground.GroundImage != null)
                //{
                //    ground.FileName = ground.GroundImage.FileName;
                //    using (var stream = new FileStream(Path.Combine(directory, ground.FileName), FileMode.Create))
                //    {
                //        await ground.GroundImage.CopyToAsync(stream);
                //    }
                //}
                var users = await _userManager.GetUserAsync(HttpContext.User);

                var groundModal = _mapper.Map <Ground>(ground);
                //groundModal.UserId = users.Id;
                _context.Ground.Update(groundModal);
                await _context.SaveChangesAsync();

                return(Json(ResponseHelper.UpdateSuccess()));
            }
            return(Json(ResponseHelper.UpdateUnSuccess()));
        }
        public async Task <int> AddGroundAsync([FromBody] Grounddto ground)
        {
            if (ModelState.IsValid)
            {
                var groundModel = _mapper.Map <Ground>(ground);
                await _context.Ground.AddAsync(groundModel);

                await _context.SaveChangesAsync();

                return(groundModel.GroundId);
            }
            return(0);
        }