예제 #1
0
 public bool Upd(int id, TimeLine tl)
 {
     if (tl is null)
     {
         throw new NullReferenceException($"TimeLine Data empty ({where}) (UPD)");
     }
     return(_globalService.Upd(id, tl.ToGlobal()));
 }
예제 #2
0
 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));
     }
 }
예제 #3
0
        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"));
            }
        }
예제 #4
0
 public bool Upd(int id, TimeLine tl)
 {
     return(_globalService.Upd(id, tl.ToGlobal()));
 }