public IActionResult RemoveFollow(RemoveFollowDTO model) { try { if (!_userService.Exists(model.FollowingId) && !_userService.Exists(model.FollowersId)) { return(NotFound("Kullanıcı yok")); } //önceden takip ediyormuyum? if (_followService.AmIFollowing(model.FollowersId, model.FollowingId)) { var removefollow = _followService.Get(i => i.FollowingId == model.FollowersId && i.FollowersId == model.FollowersId); _followService.Delete(removefollow); return(Ok("Başarılı")); } return(BadRequest("Bir sıkıntı oluştu!")); } catch (Exception e) { return(BadRequest(e)); } }
public ActionResult Delete(int id) { var followModel = _service.GetFollowById(id); if (followModel == null) { return(NotFound()); } _service.Delete(followModel); _service.SaveChanges(); return(NoContent()); }
public async Task <IActionResult> Delete([FromRoute] string nameUserFollower, [FromRoute] int idUserFollowing) { Response result = await _followService.Delete(nameUserFollower, idUserFollowing); return(Ok(result)); }