public ActionResult PostAttach([FromBody] PetActivityDTO value) { PetActivity petactivity = ToPetActivity.DividePetActivity(value); _petActivityRepository.Insert(petactivity); if (_petActivityRepository.Save()) { return(Ok(new { petid = value.PetId, activityid = value.ActivityId })); } return(Ok("eroare")); }
public ActionResult Post([FromBody] PetActivityDTO value) { var activity = ToPetActivity.DiviteActivity(value); var petactivity = ToPetActivity.DividePetActivity(value); petactivity.PetId = value.PetId; _activityRepository.Insert(activity); _activityRepository.Save(); int activityId = _activityRepository.GetByTitleAndDescription(value.Title, value.Description, value.ExpPoints).ActivityId; petactivity.ActivityId = activityId; _petActivityRepository.Insert(petactivity); if (_petActivityRepository.Save()) { return(Ok(new { petid = value.PetId, activityid = activityId })); } return(Ok("eroare")); }