// GET: EczaneNobet/EczaneNobetMazeret/Details/5
        public ActionResult Details(int id)
        {
            if (id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EczaneNobetMazeret eczaneNobetMazeret = _eczaneNobetMazeretService.GetById(id);

            if (eczaneNobetMazeret == null)
            {
                return(HttpNotFound());
            }
            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."));
            }
        }