Ejemplo n.º 1
0
        public async Task <IActionResult> UpdateBar(BarViewModel updatedBar, Guid id)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var barDTO = updatedBar.GetDtoFromVM();
                    await barServices.UpdateBar(id, barDTO);

                    this.toastNotification.AddSuccessToastMessage(Exceptions.SuccessfullyUpdated);
                    return(RedirectToAction("ListBars", "Bar", new { Area = "" }));
                }
                catch (Exception)
                {
                    this.toastNotification.AddWarningToastMessage(Exceptions.SomethingWentWrong);
                    return(RedirectToAction("ListBars", "Bar", new { Area = "" }));
                }
            }
            return(View(updatedBar));
        }