public IActionResult Create(Constant constant) { if (HttpContext.Session.GetString("Name") == null) { return(RedirectToAction("Login", "Admin")); } if (constant.Id == 0) { var kayıt = constantService.Add(constant); TempData["Mesaj"] = kayıt.BasariliMi ? "Kayıt Eklendi." : kayıt.Mesaj; return(RedirectToAction("Create", "Constant")); } else { var kayıt = constantService.Get(x => x.Id == constant.Id).Data; constant.LogoUrl = kayıt.LogoUrl; constantService.Update(constant); return(RedirectToAction("Index", "Constant")); } }
public IActionResult Post([FromBody] Constant data) { var createdConstant = service.Add(data); return(CreatedAtAction("Get", new { id = createdConstant.Data.Id }, createdConstant)); }