public ActionResult Edit(int id) { if (id == 0) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EczaneNobetMazeret eczaneNobetMazeret = _eczaneNobetMazeretService.GetById(id); if (eczaneNobetMazeret == null) { return(HttpNotFound()); } var user = _userService.GetByUserName(User.Identity.Name); var yil = DateTime.Now.AddMonths(1).Year; var ay = DateTime.Now.AddMonths(1).Month; var tarihler = _takvimService.GetList() .Where(w => w.Tarih.Year == yil //&& w.Tarih.Month == ay ) .Select(s => new MyDrop { Id = s.Id, Value = s.Tarih.ToLongDateString() }); 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(tarihler, "Id", "Value", eczaneNobetMazeret.TakvimId); return(View(eczaneNobetMazeret)); }
public ActionResult DeleteConfirmed(int id) { EczaneNobetMazeret eczaneNobetMazeret = _eczaneNobetMazeretService.GetById(id); _eczaneNobetMazeretService.Delete(id); return(RedirectToAction("Index")); }
// 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)); }
public HttpResponseMessage MazeretEkleCoklu([FromBody] EczaneNobetMazeretCokluApi eczaneNobetMazeretCokluApi) { LoginItem loginUser; User user; _yetkilendirme.YetkiKontrolu(eczaneNobetMazeretCokluApi, out loginUser, out user); string token = _yetkilendirme.GetToken2(loginUser); if (user != null) { if (token == eczaneNobetMazeretCokluApi.Token) { try { foreach (var item in eczaneNobetMazeretCokluApi.Tarihler) { Takvim takvim = _takvimService.GetByTarih(Convert.ToDateTime(item)); EczaneNobetMazeret eczaneNobetMazeret = new EczaneNobetMazeret(); eczaneNobetMazeret.TakvimId = takvim.Id; eczaneNobetMazeret.EczaneNobetGrupId = eczaneNobetMazeretCokluApi.EczaneNobetGrupId; eczaneNobetMazeret.Aciklama = eczaneNobetMazeretCokluApi.Aciklama; eczaneNobetMazeret.MazeretId = Convert.ToInt32(eczaneNobetMazeretCokluApi.MazeretId); _eczaneNobetMazeretService.Insert(eczaneNobetMazeret); } return(Request.CreateResponse(HttpStatusCode.OK)); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, 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.")); } //else // return Request.CreateResponse(HttpStatusCode.Unauthorized); }
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)); }
//[HttpPost] public void SecilenleriSil(string selectedEczaneMazeretIstekIDs, string unSelectedEczaneMazeretIstekIDs) { var cor = "Seçim Yapmadınız!"; if (selectedEczaneMazeretIstekIDs == "") { throw new Exception(cor); //return Json(cor, JsonRequestBehavior.AllowGet); } //seçilenleri sil var eczaneNobetMazeret = new EczaneNobetMazeret(); var eczaneNobetIstek = new EczaneNobetIstek(); var silinecekKayitlar = selectedEczaneMazeretIstekIDs.Split(','); foreach (string item in silinecekKayitlar) { var id = item.Substring(0, item.IndexOf(';')); var ind = item.IndexOf(';'); var tur = item.Substring(item.IndexOf(';') + 1, item.Length - item.IndexOf(';') - 1); if (tur == "1") { //eczaneNobetMazeret = _eczaneNobetMazeretService.GetById(Convert.ToInt32(id)); _eczaneNobetMazeretService.Delete(Convert.ToInt32(id)); } else if (tur == "2") { //eczaneNobetIstek = _eczaneNobetIstekService.GetById(Convert.ToInt32(id)); _eczaneNobetIstekService.Delete(Convert.ToInt32(id)); } } //TempData["silinenMazeretSayisi"] = liste.Length; //seçilmeyenleri döndür //var eczaneNobetMazeretlerVeIstekler = new List<EczaneNobetMazeretIstekDetay>(); //eczaneNobetMazeretlerVeIstekler = GetModel(unSelectedEczaneMazeretIstekIDs); //return PartialView("EczaneNobetMazeretPartialView", eczaneNobetMazeretlerVeIstekler); // return Json(unSelectedEczaneMazeretIstekIDs, JsonRequestBehavior.AllowGet); }
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.")); } }
public void Update(EczaneNobetMazeret sonuc) { _eczaneNobetMazeretDal.Update(sonuc); }
public void Insert(EczaneNobetMazeret sonuc) { _eczaneNobetMazeretDal.Insert(sonuc); }