public IActionResult Create(PhotoCategory photoCategory) { if (HttpContext.Session.GetString("Name") == null) { return(RedirectToAction("Login", "Admin")); } if (photoCategory.Order != 0) { var result = photoCategoryService.Get(x => x.Order == photoCategory.Order && x.isDelete == false).Data; if (photoCategory.Id == 0) { if (result == null) { var kayıt = photoCategoryService.Add(photoCategory); TempData["Mesaj"] = kayıt.BasariliMi ? "Kayıt Eklendi." : kayıt.Mesaj; return(RedirectToAction("Create", "Gallery")); } else { TempData["Mesaj"] = "Aynı sıra numarasına ait iki kayıt olamaz."; return(View()); } } else { var kayıt = photoCategoryService.Get(x => x.Id == photoCategory.Id).Data; if (result == null) { photoCategoryService.Update(photoCategory); return(RedirectToAction("Category", "Gallery")); } else { TempData["Mesaj"] = "Aynı sıra numarasına ait iki kayıt olamaz."; return(View()); } } } else { TempData["Mesaj"] = "Sıra numarası giriniz."; return(View()); } }
public IActionResult Update([FromBody] PhotoCategory data) { if (service.Get(x => x.Id == data.Id) != null) { data.isActive = true; return(Ok(service.Update(data))); } return(NotFound()); }