public ActionResult <string> Create(FriendDto dto) { LibraryAPI.Core.Domain.Freind friend = LibraryAPI.Core.Domain.Freind.AddFreind(dto.friendName, dto.userid, dto.email); _friendRepo.AddFriend(friend); return(friend.GetLink()); }
public async Task <IActionResult> AddFriend([FromBody] Friend model) { if (ModelState.IsValid) { try { var friendId = await friendRepository.AddFriend(model); if (friendId > 0) { return(Ok(friendId)); } else { return(NotFound()); } } catch (Exception) { return(BadRequest()); } } return(BadRequest()); }
public IActionResult AddFriend([FromBody] FriendList friend) { int res = _frdRepo.AddFriend(friend); if (res != 0) { return(Ok()); } return(Forbid()); }
/* * Create a new Friend entity */ public Friend AddFriend(Friend friend) { return(_friendRepository.AddFriend(friend)); }
public ActionResult <Friend> PostFriend(AddFriend addFriend) { _friendRepository.AddFriend(addFriend); return(Ok()); }