public async Task <IActionResult> Edit(int id, GuestReservation guestReservation)
        {
            if (id != guestReservation.Id)
            {
                ViewBag.ErrorMessage = "لايوجد   بيانات";
                return(View("NotFound"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _repository.Update <GuestReservation>(guestReservation);
                    await _repository.SavaAll();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (_repository.GetBank(guestReservation.Id) == null)
                    {
                        ViewBag.ErrorMessage = "لايوجد   بيانات";
                        return(View("NotFound"));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            ViewData["MGuideId"] = new SelectList(await _repository.GetGuides(), "Id", "Name", guestReservation.MGuideId);
            ViewData["SheikhId"] = new SelectList(await _repository.GetSheikhs(), "Id", "Name", guestReservation.SheikhId);
            return(View(guestReservation));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id)
        {
            var bank = await _repository.GetBank(id);

            if (bank == null)
            {
                ViewBag.ErrorMessage = "لايوجد   بيانات";
                return(View("NotFound"));
            }

            return(View(bank));
        }
Esempio n. 3
0
        public async Task <IActionResult> Edit(int id, Sheikh sheikh)
        {
            if (id != sheikh.Id)
            {
                ViewBag.ErrorMessage = "لايوجد   بيانات";
                return(View("NotFound"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _repository.Update <Sheikh>(sheikh);
                    await _repository.SavaAll();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (_repository.GetBank(sheikh.Id) == null)
                    {
                        ViewBag.ErrorMessage = "لايوجد   بيانات";
                        return(View("NotFound"));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(sheikh));
        }