Ejemplo n.º 1
0
        public async Task <IActionResult> NotablesByReservation(int guestReservationId)
        {
            var guestReservation = await _repository.GetGuestReservation(guestReservationId);

            if (guestReservation == null)
            {
                string message = $" لايوجد حجز بهذا الرقم : {guestReservationId}";
                return(RedirectToAction("Index", "GuestReservations").WithDanger("danger", message));
            }
            ViewBag.guestReservationId = guestReservationId;
            return(View(guestReservation));
        }
        public async Task <IActionResult> Edit(int id)
        {
            var guestReservation = await _repository.GetGuestReservation(id);

            if (guestReservation == null)
            {
                ViewBag.ErrorMessage = "لايوجد   بيانات";
                return(View("NotFound"));
            }
            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));
        }
Ejemplo n.º 3
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));
        }