public async Task <IHttpActionResult> Get(long id, string appKey) { if (id == 0 || string.IsNullOrEmpty(appKey)) { return(BadRequest(Constants.HttpMessages.NoEntryWasPassed)); } try { Event eventEntry = await EventBusiness.GetByIdAsync(id, appKey); var eventResponse = Mapper.Map <EventResponseModel>(eventEntry); var response = new ApiResponse <EventResponseModel> { Message = string.Empty, Payload = eventResponse, StatusCode = Constants.ApiResponseCodes.OK }; return(Ok(response)); } catch (ArgumentException ax) { LogBuddy.LogError(ax); return(NotFound()); } catch (Exception ex) { LogBuddy.LogError(ex); return(InternalServerError(ex)); } }
public async Task <ActionResult> GetEvent(long id, string appKey) { try { Event eventEntry = await EventBusiness.GetByIdAsync(id, appKey); return(PartialView("EventDetails", eventEntry)); } catch (Exception ex) { Logger.LogError(ex); return(new ContentResult { Content = "An error occured." }); } }