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)); }
public async Task <IActionResult> Create(int countryId, MessageSendCMV messageSendCMV) { var country = await _repository.GetCountry(countryId); if (country == null) { return(RedirectToAction(nameof(Index)).WithDanger("danger", mContryNotExixit)); } if (ModelState.IsValid) { var message = _mapper.Map <MessageSend>(messageSendCMV); var wjahs = await _repository.GetNotablesByCountry(countryId); var typeMessage = await _repository.GetTypesMessage(messageSendCMV.TypesMessageId); var messageSend = await _repository.GetWjhaaMessage(messageSendCMV.WjhaaMessageId); foreach (var wjeeh in wjahs) { message.NotableId = wjeeh.Id; message.AppUserId = getUserId(); _repository.Add <MessageSend>(message); await _emailSender.SendEmailAsync(wjeeh.Email, "رسالة" + typeMessage.Name, messageSend.Message); } await _repository.SavaAll(); return(RedirectToAction(nameof(Index)).WithSuccess("success", sMessage)); } return(View(await _repository.GetCountries())); }
public async Task <IActionResult> Create(int itemOfProductId, ItemExport itemExport) { var itemOfProduct = await _repository.GetItemOfProduct(itemOfProductId); if (itemOfProduct == null) { ViewBag.ErrorMessage = "لايوجد بيانات"; return(View("NotFound")); } if (await _repository.CheckIfImportsEqualExport(itemOfProductId, itemExport.Qty)) { ViewBag.ItemOfProductId = itemOfProduct.Id; ViewBag.ItemOfProductName = itemOfProduct.Name; return(View(itemExport).WithDanger("danger", "الكمية غير كافية")); } if (ModelState.IsValid) { _repository.Add <ItemExport>(itemExport); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } ViewBag.ItemOfProductId = itemOfProduct.Id; ViewBag.ItemOfProductName = itemOfProduct.Name; return(View(itemExport)); }
public async Task <IActionResult> Create(University university) { if (ModelState.IsValid) { _repository.Add <University>(university); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(university)); }
public async Task <IActionResult> Create(Specialization specialization) { if (ModelState.IsValid) { _repository.Add <Specialization>(specialization); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(specialization)); }
public async Task <IActionResult> Create(Jop jop) { if (ModelState.IsValid) { _repository.Add <Jop>(jop); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(jop)); }
public async Task <IActionResult> Create(TypeOfProduct typeOfProduct) { if (ModelState.IsValid) { _repository.Add <TypeOfProduct>(typeOfProduct); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(typeOfProduct)); }
public async Task <IActionResult> Create(Bank bank) { if (ModelState.IsValid) { _repository.Add <Bank>(bank); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(bank)); }
public async Task <IActionResult> Create(Language language) { if (ModelState.IsValid) { _repository.Add <Language>(language); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(language)); }
public async Task <IActionResult> Create(Sheikh sheikh) { if (ModelState.IsValid) { _repository.Add <Sheikh>(sheikh); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } return(View(sheikh)); }
public async Task <IActionResult> Create(JobNotable jobNotable) { if (ModelState.IsValid) { _repository.Add <JobNotable>(jobNotable); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } ViewData["TypeNotableId"] = new SelectList(await _repository.GetTypeNotables(), "Id", "Name", jobNotable.TypeNotableId); return(View(jobNotable)); }
public async Task <IActionResult> Create(WorkSeason workSeason) { if (ModelState.IsValid) { _repository.Add <WorkSeason>(workSeason); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } ViewData["SeasonId"] = new SelectList(await _repository.GetSeasons(), "Id", "Name"); return(View(workSeason)); }
public async Task <IActionResult> Create(Country country) { if (ModelState.IsValid) { _repository.Add <Country>(country); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } ViewData["ContinentId"] = new SelectList(await _repository.GetContinents(), "Id", "Name", country.ContinentId); return(View(country)); }
public async Task <IActionResult> Create(ItemOfProduct itemOfProduct) { if (ModelState.IsValid) { _repository.Add <ItemOfProduct>(itemOfProduct); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } ViewData["TypeOfProductId"] = new SelectList(await _repository.GetTypeOfProducts(), "Id", "Name", itemOfProduct.Id); return(View(itemOfProduct)); }
public async Task <IActionResult> Create(GuestReservation guestReservation) { if (ModelState.IsValid) { _repository.Add <GuestReservation>(guestReservation); await _repository.SavaAll(); 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)); }
public async Task <IActionResult> Create(Employee employee) { if (ModelState.IsValid) { _repository.Add <Employee>(employee); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } ViewData["JopId"] = new SelectList(await _repository.GetJops(), "Id", "Name"); ViewData["UserId"] = new SelectList(await _repository.GetUsers(), "Id", "FullName"); return(View(employee)); }
public async Task <IActionResult> Create(WjhaaMessage wjhaaMessage) { if (ModelState.IsValid) { _repository.Add <WjhaaMessage>(wjhaaMessage); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } ViewData["CountryId"] = new SelectList(await _repository.GetCountries(), "Id", "Name", wjhaaMessage.CountryId); ViewData["MGuideId"] = new SelectList(await _repository.GetGuides(), "Id", "Name", wjhaaMessage.MGuideId); ViewData["TypesMessageId"] = new SelectList(await _repository.GetTypesMessages(), "Id", "Name", wjhaaMessage.TypesMessageId); return(View(wjhaaMessage)); }
public async Task <IActionResult> Create(int guestReservationId, Notable notable) { if (ModelState.IsValid) { _repository.Add <Notable>(notable); await _repository.SavaAll(); return(RedirectToAction(nameof(NotablesByReservation), new { guestReservationId = guestReservationId })); } ViewBag.guestReservationId = guestReservationId; ViewData["CountryId"] = new SelectList(await _repository.GetCountries(), "Id", "Name", notable.CountryId); ViewData["JobNotableId"] = new SelectList(await _repository.GetJobNotables(), "Id", "Name", notable.JobNotableId); return(View(notable)); }
public async Task <IActionResult> Create(EmployeeAttendCMV employeeAttendCMV) { if (ModelState.IsValid) { var attend = _mapper.Map <Attend>(employeeAttendCMV); var contract = await _repository.GetEmployeeContractByEmpId(employeeAttendCMV.EmployeeId); attend.EmployeeContractId = contract.Id; attend.WorkingHours = contract.DailyWorkingHours; attend.AppUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); _repository.Add <Attend>(attend); await _repository.SavaAll(); return(RedirectToAction(nameof(Index)).WithSuccess("success", "تم الحفظ بنجاح")); } ViewData["TheWork"] = new SelectList(TheWorName(), "ThWork", "ThWork", employeeAttendCMV.TheWork); ViewData["EmployeeId"] = new SelectList(await _repository.GetEmployeeContractActive(), "Id", "Name", employeeAttendCMV.EmployeeId); return(View()); }
public async Task <IActionResult> Create(MGuide mGuide) { if (ModelState.IsValid) { _repository.Add <MGuide>(mGuide); await _repository.SavaAll(); return(RedirectToAction(nameof(Index)).WithSuccess("success", "تم حفظ البيانات بنجاح")); } ViewData["CountryId"] = new SelectList(await _repository.GetCountries(), "Id", "Name", mGuide.CountryId); ViewData["BankId"] = new SelectList(await _repository.GetBanks(), "Id", "Name", mGuide.BankId); ViewData["UniversityId"] = new SelectList(await _repository.GetUniversities(), "Id", "Name", mGuide.UniversityId); ViewData["StageId"] = new SelectList(await _repository.GetStages(), "Id", "Name", mGuide.StageId); ViewData["LevelId"] = new SelectList(await _repository.GetLevels(), "Id", "Name", mGuide.LevelId); ViewData["LanguageId"] = new SelectList(await _repository.GetLanguages(), "Id", "Name", mGuide.LanguageId); ViewData["SpecializationId"] = new SelectList(await _repository.GetSpecializations(), "Id", "Name", mGuide.SpecializationId); ViewData["AppUserId"] = new SelectList(await _repository.GetUsers(), "Id", "FullName", mGuide.AppUserId); ViewData["CollegeId"] = new SelectList(await _repository.GetColleges(), "Id", "Name", mGuide.CollegeId); return(View(mGuide)); }
public async Task <IActionResult> Create(GuidesAttendsCMV guidesAttendsCMV) { if (ModelState.IsValid) { var contract = await _repository.GetGuideContractByGuideId(guidesAttendsCMV.GuideId); var attend = new Attend() { AppUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value), GuideContractId = contract.Id, TheWork = guidesAttendsCMV.TheWork, WorkingHours = contract.DailyWorkingHours, GuideId = guidesAttendsCMV.GuideId, AttendDate = guidesAttendsCMV.AttendDate }; _repository.Add <Attend>(attend); await _repository.SavaAll(); return(RedirectToAction(nameof(Index)).WithSuccess("success", "تم الحفظ بنجاح")); } ViewData["TheWork"] = new SelectList(TheWorName(), "ThWork", "ThWork", guidesAttendsCMV.TheWork); ViewData["EmployeeId"] = new SelectList(await _repository.GetGuideContractActive(), "Id", "Name", guidesAttendsCMV.GuideId); return(View()); }
public async Task <IActionResult> Create(EmployeeContract employeeContract) { if (ModelState.IsValid) { var status = await _repository.IsEemployeeHasContractActive(employeeContract.EmployeeId); if (status == true && employeeContract.Status == true) { ViewData["JopId"] = new SelectList(await _repository.GetJops(), "Id", "Name"); ViewData["SeasonId"] = new SelectList(await _repository.GetSeasons(), "Id", "Name"); ViewData["EmployeeId"] = new SelectList(await _repository.GetEmployees(), "Id", "Name"); return(View(employeeContract).WithDanger("danger", "لايمكن اضافة العقد . يوجد عقد سابق ")); } _repository.Add <EmployeeContract>(employeeContract); await _repository.SavaAll(); return(RedirectToAction(nameof(Index))); } ViewData["JopId"] = new SelectList(await _repository.GetJops(), "Id", "Name"); ViewData["SeasonId"] = new SelectList(await _repository.GetSeasons(), "Id", "Name"); ViewData["EmployeeId"] = new SelectList(await _repository.GetEmployees(), "Id", "Name"); return(View(employeeContract)); }