public ActionResult Edit([Bind(Include = "Id,EczaneNobetGrupId,MazeretId,TakvimId,Aciklama")] EczaneNobetMazeret eczaneNobetMazeret)
        {
            if (ModelState.IsValid)
            {
                _eczaneNobetMazeretService.Update(eczaneNobetMazeret);
                return(RedirectToAction("Index"));
            }
            var user      = _userService.GetByUserName(User.Identity.Name);
            var eczaneler = _eczaneService.GetListByUser(user).Select(s => s.Id).ToList();

            ViewBag.EczaneNobetGrupId = new SelectList(_eczaneNobetGrupService.GetDetaylarByEczaneIdList(eczaneler)
                                                       .Select(s => new MyDrop {
                Id = s.Id, Value = $"{s.EczaneAdi} ({s.NobetGrupAdi})"
            }).OrderBy(s => s.Value), "Id", "Value", eczaneNobetMazeret.EczaneNobetGrupId);
            ViewBag.MazeretId = new SelectList(_mazeretService.GetList(), "Id", "Adi", eczaneNobetMazeret.MazeretId);
            ViewBag.TakvimId  = new SelectList(_takvimService.GetList(), "Id", "Tarih", eczaneNobetMazeret.TakvimId);
            return(View(eczaneNobetMazeret));
        }
Esempio n. 2
0
        public HttpResponseMessage mazeretGuncelle([FromBody] EczaneNobetMazeretApi eczaneNobetMazeretApi)
        {
            LoginItem loginUser;
            User      user;

            _yetkilendirme.YetkiKontrolu(eczaneNobetMazeretApi, out loginUser, out user);
            string token = _yetkilendirme.GetToken2(loginUser);

            if (user != null)
            {
                if (token == eczaneNobetMazeretApi.Token)
                {
                    try
                    {
                        Takvim             takvim             = _takvimService.GetByTarih(Convert.ToDateTime(eczaneNobetMazeretApi.Tarih));
                        EczaneNobetMazeret eczaneNobetMazeret = _eczaneNobetMazeretService.GetById(eczaneNobetMazeretApi.Id);
                        eczaneNobetMazeret.TakvimId          = takvim.Id;
                        eczaneNobetMazeret.EczaneNobetGrupId = eczaneNobetMazeretApi.EczaneNobetGrupId;
                        eczaneNobetMazeret.Aciklama          = eczaneNobetMazeretApi.Aciklama;
                        eczaneNobetMazeret.MazeretId         = Convert.ToInt32(eczaneNobetMazeretApi.MazeretId);
                        _eczaneNobetMazeretService.Update(eczaneNobetMazeret);
                        return(Request.CreateResponse(HttpStatusCode.OK));
                    }
                    catch (Exception e)
                    {
                        return(Request.CreateResponse(HttpStatusCode.Unauthorized, e.Message + e.InnerException.StackTrace));
                    }
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.Conflict, "Token geçersiz."));
                }
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.Unauthorized, "Kullanıcı adı ve şifresi geçersiz."));
            }
        }