public JsonResult AddParty([FromBody] PartyModel party)
        {
            var result = _partyservice.AddParty(party);

            if (!result)
            {
                return(new JsonResult("Party could not be added"));
            }

            return(new JsonResult("Party Added"));
        }
Beispiel #2
0
 public ActionResult AddParty(PartyModel partyModel)
 {
     try
     {
         _partyService.AddParty(partyModel);
         return(Ok(new { Success = true, data = "Success" }));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, new { Success = false, data = "Internal Server Error", Message = ex.Message }));
     }
 }
        public async Task <IActionResult> Post([FromBody] Party party)
        {
            User user = await _userManager.FindByNameAsync(User.Identity.Name);

            if (user == null)
            {
                return(NotFound());
            }
            party.OwnerId = user.Id;
            _partyService.AddParty(party);


            return(CreatedAtAction(nameof(Get), new { id = party.Id }, party));
        }
Beispiel #4
0
        public ActionResult Add(CreatePartyViewModel partyViewModel)
        {
            if (ModelState.IsValid)
            {
                Party party = _mapper.Map <Party>(partyViewModel);

                _partyService.AddParty(party);

                return(RedirectToAction("List", "Party", new { id = partyViewModel.OwnerId }));
            }
            else
            {
                return(View(partyViewModel));
            }
        }
 public IActionResult AddParty([FromBody] PartyDetailsVM partyDetailsVM)
 {
     _partyService.AddParty(partyDetailsVM);
     return(Ok());
 }