public IActionResult Update(int id) { TempData["active"] = "sosyalmedya"; var updatedEntity = _socialMediaIconService.GetById(id); var model = new SocialMediaIconUpdateDto(); model.Link = updatedEntity.Link; model.Icon = updatedEntity.Icon; model.AppUserId = updatedEntity.AppUserId; model.Id = updatedEntity.Id; return(View(model)); }
public IActionResult Update(SocialMediaIconUpdateDto model) { if (ModelState.IsValid) { var updatedEntity = _socialMediaIconService.GetById(model.Id); updatedEntity.AppUserId = model.AppUserId; updatedEntity.Icon = model.Icon; updatedEntity.Link = model.Link; _socialMediaIconService.Update(updatedEntity); TempData["message"] = "İşlem başarıyla gerçekleşti"; return(RedirectToAction("Index")); } return(View(model)); }
public IActionResult Update(SocialMediaIconUpdateDto model) { TempData["active"] = "ikon"; if (ModelState.IsValid) { var user = _appUserService.FindByName(User.Identity.Name); var updatedSocialMediaIcon = _socialMediaIconService.GetById(model.Id); updatedSocialMediaIcon.AppUserId = user.Id; updatedSocialMediaIcon.Icon = model.Icon; updatedSocialMediaIcon.Link = model.Link; _socialMediaIconService.Update(updatedSocialMediaIcon); TempData["message"] = "Güncelleme işlemi başarılı"; return(RedirectToAction("Index")); } return(View(model)); }