Exemplo n.º 1
0
        public async Task <IActionResult> Delete(int id)
        {
            var notable = await _repository.GetNotable(id);

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

            try
            {
                _repository.Delete <Notable>(notable);
                await _repository.SavaAll();
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = $"لايمكن حذف   : ( {notable.Name} )  اذا اردت الحذف الرجاء حذف جميع  الحقول المرتبطة ";
                ViewBag.ex           = ex.GetBaseException();
                return(View("NotFound"));
            }

            return(RedirectToAction(nameof(NotablesByReservation),
                                    new { guestReservationId = notable.GuestReservationId }));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create(int guestReservationId, List <Gift> gifts)
        {
            if (ModelState.IsValid)
            {
                var allGifts = await _repository.GetGiftsByGuestReservationId(guestReservationId);

                foreach (var gift in allGifts)
                {
                    _repository.Delete <Gift>(gift);
                }
                await _repository.SavaAll();

                foreach (var gift in gifts)
                {
                    _repository.Add <Gift>(gift);
                }
                await _repository.SavaAll();

                var guest = await _repository.GetGuestReservation(guestReservationId);

                if (!await _repository.GetCheckGuidHaveWorkInTheDay(guest.MGuideId.Value, guest.ReservationDate))
                {
                    var contract = await _repository.GetGuideContractByGuideId(guest.MGuideId.Value);

                    var attend = new Attend()
                    {
                        GuideContractId = contract.Id,
                        TheWork         = "وجهاء",
                        WorkingHours    = contract.DailyWorkingHours,
                        GuideId         = guest.MGuideId.Value,
                        AttendDate      = guest.ReservationDate
                    };
                    _repository.Add <Attend>(attend);
                    await _repository.SavaAll();
                }
                return(RedirectToAction("NotablesByReservation", "Notables",
                                        new { guestReservationId = guestReservationId }).WithSuccess("success", "تم الحفظ بنجاخ"));
            }
            ViewData["ItemOfProducts"] = await _repository.GetItemOfProducts();

            ViewBag.guestReservationId = guestReservationId;
            var JobNotablesNormal = await _repository.GetJobNotablesNormal(guestReservationId);

            var JobNotablesNotNormal = await _repository.GetJobNotablesNotNormal(guestReservationId); await _repository.GetJobNotablesNormal(guestReservationId);

            ViewBag.notableNormal    = JobNotablesNormal.Count();
            ViewBag.notableNotNormal = JobNotablesNotNormal.Count();
            return(View(gifts));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Delete(int id)
        {
            var jop = await _repository.GetJop(id);

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

            try
            {
                _repository.Delete <Jop>(jop);
                await _repository.SavaAll();
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = $"لايمكن حذف   : ( {jop.Name} )  اذا اردت الحذف الرجاء حذف جميع  الحقول المرتبطين بهذا الوظيفة ";
                ViewBag.ex           = ex.GetBaseException();
                return(View("NotFound"));
            }

            return(RedirectToAction(nameof(Index)));
        }
        public async Task <IActionResult> Delete(int id)
        {
            var attend = await _repository.GetAttend(id);

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

            try
            {
                _repository.Delete <Attend>(attend);
                await _repository.SavaAll();
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = $"لايمكن حذف   : ( {attend.Id} )  اذا اردت الحذف الرجاء حذف جميع  الحقول المرتبطة ";
                ViewBag.ex           = ex.GetBaseException();
                return(View("NotFound"));
            }

            return(RedirectToAction(nameof(Index)).WithSuccess("success", "تم الحفظ بنجاح"));
        }
        public async Task <IActionResult> Delete(int id)
        {
            var guestReservation = await _repository.GetGuestReservation(id);

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

            try
            {
                _repository.Delete <GuestReservation>(guestReservation);
                await _repository.SavaAll();
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = $"لايمكن حذف   : ( {guestReservation.SessionNo} )  اذا اردت الحذف الرجاء حذف جميع  الحقول المرتبطة ";
                ViewBag.ex           = ex.GetBaseException();
                return(View("NotFound"));
            }

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Delete(int id)
        {
            var typeOfProduct = await _repository.GetTypeOfProduct(id);

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

            try
            {
                _repository.Delete <TypeOfProduct>(typeOfProduct);
                await _repository.SavaAll();
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = $"لايمكن حذف   : ( {typeOfProduct.Name} )  اذا اردت الحذف الرجاء حذف جميع  الحقول المرتبطين بهذا الموسم ";
                ViewBag.ex           = ex.GetBaseException();
                return(View("NotFound"));
            }

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Delete(int id)
        {
            var wjhaaMessage = await _repository.GetWjhaaMessage(id);

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

            try
            {
                _repository.Delete <WjhaaMessage>(wjhaaMessage);
                await _repository.SavaAll();
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = $"لايمكن حذف   : ( {wjhaaMessage.Message} )  اذا اردت الحذف الرجاء حذف جميع  الحقول المرتبطين   ";
                ViewBag.ex           = ex.GetBaseException();
                return(View("NotFound"));
            }

            return(RedirectToAction(nameof(Index)));
        }
Exemplo n.º 8
0
        public async Task <IActionResult> Delete(int id)
        {
            var mGuide = await _repository.GetGuide(id);

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

            try
            {
                _repository.Delete <MGuide>(mGuide);
                await _repository.SavaAll();
            }
            catch (Exception ex)
            {
                ViewBag.ErrorMessage = $"لايمكن حذف   : ( {mGuide.Name} )  اذا اردت الحذف الرجاء حذف جميع  الحقول المرتبطين بهذا الموسم ";
                ViewBag.ex           = ex.GetBaseException();
                return(View("NotFound"));
            }

            return(RedirectToAction(nameof(Index)).WithSuccess("success", "تم الحذف بنجاح"));
        }