public IActionResult Edit(int id)
        {
            if (_sessionManager.User is not null)
            {
                TimeLine tl = _timeLineService.Get(_sessionManager.User.Id, id);

                TimeLineUpdForm start = new TimeLineUpdForm()
                {
                    NbrGuests           = tl.NbrGuests
                    , DinerDate         = tl.DinerDate
                    , SelectedResaurant = tl.RestaurantId
                    , Restaurants       = GetRestaurants()
                };
                return(View(start));
            }
            else
            {
                return(RedirectToAction("Login", "Auth"));
            }
        }
 public IActionResult Upd([FromRoute] int userId, [FromRoute] int id, [FromBody] TimeLineUpdForm tl)
 {
     try
     {
         if (tl is null)
         {
             throw new ArgumentNullException("TimeLine Object Empty (UPD)");
         }
         TimeLine tlo = new TimeLine()
         {
             Id = id, UserId = tl.UserId, RestaurantId = tl.RestaurantId, DinerDate = tl.DinerDate, NbrGuests = tl.NbrGuests
         };
         bool UpdOk = _clientService.Upd(id, tlo);
         return(ApiControllerHelper.SendOk(this, new ApiResult <bool>(HttpStatusCode.OK, null, UpdOk), true));
     }
     catch (Exception ex)
     {
         return(ApiControllerHelper.SendError(this, ex));
     }
 }
        public IActionResult Edit(int id, TimeLineUpdForm form)
        {
            if (_sessionManager.User is not null)
            {
                try
                {
                    if (ModelState.IsValid)
                    {
                        TimeLine tl = new TimeLine()
                        {
                            Id             = id
                            , DinerDate    = form.DinerDate
                            , NbrGuests    = form.NbrGuests
                            , UserId       = _sessionManager.User.Id
                            , RestaurantId = form.SelectedResaurant
                        };

                        bool updated = _timeLineService.Upd(id, tl);
                        if (!updated)
                        {
                            ViewBag.Message = "Error: Time Line NOT Updated (" + id.ToString() + ")";
                        }
                        return(RedirectToAction("index"));
                    }
                }
                catch (Exception ex)
                {
                    ModelState.AddModelError("", ex.Message);
                    //ViewBag.Error = ex.Message;
                }
                return(View());
            }
            else
            {
                return(RedirectToAction("Login", "Auth"));
            }
        }