public HttpResponseMessage DeleteParty([FromBody] clsParty request) { LoggerFactory.LoggerInstance.LogDebug("Request Started for : " + request.PartyID + " Party name :" + request.PartyName); HttpResponseMessage response = new HttpResponseMessage(); try { PartyService objComService = new PartyService(); var objResponse = objComService.DeleteParty(request); if (objResponse != null && objResponse.ToString() != "") { response = Request.CreateResponse(HttpStatusCode.OK, objResponse); LoggerFactory.LoggerInstance.LogDebug("Request End for : " + request.PartyID + " Party name :" + request.PartyName); } else { response = Request.CreateErrorResponse(HttpStatusCode.NotFound, "No detail found for Party name : " + request.PartyName + "."); } } catch (Exception ex) { LoggerFactory.LoggerInstance.LogException(ex); response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while getting Party name " + request.PartyName + "."); } return(response); }
public ActionResult PartyDelete(int id, PartyModel collection) { var service = new PartyService(); service.DeleteParty(id); return(RedirectToAction("GetAllParties", "Admin", null)); }
public async Task <IHttpActionResult> DeleteParty(PartyModel party) { if (party == null) { return(BadRequest("Please provide valid inputs!")); } if (party.ID == 0) { return(BadRequest("Please provide valid party ID!")); } if (string.IsNullOrEmpty(party.Location)) { return(BadRequest("Please provide valid location!")); } if (await AuthService.ValidateUserAndToken(party.Token, party.UserID, party.Email, party.Location)) { if (await PartyService.PartyExists(party)) { if (await PartyService.DeleteParty(party)) { return(Ok("Party Deleted Successfully!")); } else { return(BadRequest("Failed To Delete Party!")); } } else { return(BadRequest("No Such Party Exists!")); } } else { return(Unauthorized()); } }
public IActionResult DeleteParty(int id) { PartyService.DeleteParty(id); return(Ok()); }