public ActionResult HocaKaydet(SistemKullanicilarModel sistemKullaniciModel, HttpPostedFileBase imageProfil, IEnumerable <int> Dersler) { int ImageId = 0; string fileName, path = null; if (imageProfil.ContentLength > 0 && imageProfil != null) { fileName = Path.GetFileName(imageProfil.FileName); path = Path.Combine(Server.MapPath("~/MedyaKutuphanesi/Images"), fileName); imageProfil.SaveAs(path); } var medyaUrl = "/MedyaKutuphanesi/Images/" + imageProfil.FileName; ImageId = medyaService.MedyaKaydet(new MedyaKutuphanesi { Aktifmi = true, MedyaAciklama = "Hoca Resmi", MedyaUrl = medyaUrl, MedyaTipi = "Resim", MedyaAdi = "Resim" }); sistemKullaniciModel.Aktifmi = true; sistemKullaniciModel.ImageId = ImageId; sistemKullaniciModel.Role = "T"; sistemKullaniciService.SistemKullaniciKaydet(sistemKullaniciModel); return(RedirectToAction("Index", "Hoca")); }
public ActionResult HocaGuncelle(SistemKullanicilarModel sistemKullaniciModel, HttpPostedFileBase imageProfil) { bool isUpdated = false; if (ModelState.IsValid) { if (imageProfil == null) { sistemKullaniciService.SistemKullaniciGuncelle(sistemKullaniciModel); } else { //ImageId bildiğin için o image ismini güncelle daha sonra diğer alanları güncelle. } isUpdated = true; } if (isUpdated) { TempData["UpdatedMessage"] = sistemKullaniciModel.AdSoyad + " başarıyla güncellenmiştir."; } else { TempData["UpdatedMessage"] = "Bir hata ile karşılaştım. Güncelleme başarısız"; } return(RedirectToAction("Index", "Hoca")); }
public JsonResult GirisYap(SistemKullanicilarModel kullanici) { string statusMessage; if (Membership.ValidateUser(kullanici.Name, kullanici.KullaniciSifre)) { FormsAuthentication.SetAuthCookie(kullanici.Name, false); statusMessage = "Basarili"; //return RedirectToAction("Index", "HomeAdmin", new {area="Admin" }); } else { statusMessage = "Basarisiz"; } return(new JsonResult { Data = statusMessage, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }