public ActionResult Edit(int?id)
        {
            var user     = _userService.GetByUserName(User.Identity.Name);
            var eczaneId = _eczaneUserService.GetListByUserId(user.Id).Select(s => s.Id).FirstOrDefault();
            int Id       = 0;

            if (id == null)
            {
                try
                {
                    Id = Convert.ToInt32(eczaneId);
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("Index", "Eczane"));
                }
            }

            //Id = Convert.ToInt32(id);

            if (id < 1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Eczane eczane = _eczaneService.GetById(Id);

            var sehirler = _sehirService.GetList();

            ViewBag.SehirId = new SelectList(sehirler, "Id", "Adi", eczane.SehirId);

            if (eczane == null)
            {
                return(HttpNotFound());
            }
            return(View(eczane));
        }
Beispiel #2
0
        public IActionResult Index()
        {
            var list = service.GetList();

            return(View(list));
        }
Beispiel #3
0
 // GET: EczaneNobet/Ilce/Create
 public ActionResult Create()
 {
     ViewBag.SehirId = new SelectList(_sehirService.GetList(), "Id", "Adi");
     return(View());
 }