public async Task <IActionResult> CreateRelationship([FromBody] Relationship relationship)
        {
            await _relationshipRepository.AddRelationship(relationship);

            await _unitOfWork.CompleteAsync();

            return(CreatedAtAction(nameof(GetRelationship), new { id = relationship.Id }, relationship));
        }
예제 #2
0
        public ActionResult CreateRelationship(RelationshipsViewModel viewModel)
        {
            if (viewModel == null)
            {
                TempData["errorMessage"] = "Invalid request.";
                return(RedirectToAction("List"));
            }

            _relationshipRepository.AddRelationship(viewModel);
            return(RedirectToAction("List"));
        }