示例#1
0
        public async Task <IActionResult> Edit(int id)
        {
            var country = await _repository.GetCountry(id);

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

            ViewData["ContinentId"] = new SelectList(await _repository.GetContinents(), "Id", "Name", country.ContinentId);

            return(View(country));
        }
        public async Task <IActionResult> Create(int countryId)
        {
            var country = await _repository.GetCountry(countryId);

            if (country == null)
            {
                return(RedirectToAction(nameof(Index)).WithDanger("danger", mContryNotExixit));
            }
            var messageSend = new MessageSendCMV {
                CountryId   = country.Id,
                CountryName = country.Name,
                AppUserId   = getUserId(),
            };

            ViewData["TypesMessageId"] = new SelectList(await _repository.GetTypesMessages(), "Id", "Name");
            ViewData["WjhaaMessageId"] = new SelectList(await _repository.GetWjhaaMessages(), "Id", "Message");

            return(View(messageSend));
        }