public HttpResponseMessage Post(MeetingVM meeting) { try { int userId = int.Parse((GetClaims.GetClaimsType(ActionContext.Request.Headers.Authorization.Parameter)).FindFirst(ClaimTypes.NameIdentifier).Value); meeting.UserId = userId; bool status = meetingInfo.InsertMeetingDetails(meeting); if (status) { var message = Request.CreateResponse(HttpStatusCode.Created, "New meeting is created successfully"); return(message); } return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "cannot insert meeting details(check the data)")); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }
public HttpResponseMessage Post(TrainingVM trainer) { try { int userId = int.Parse((GetClaims.GetClaimsType(ActionContext.Request.Headers.Authorization.Parameter)).FindFirst(ClaimTypes.NameIdentifier).Value); trainer.UserId = userId; bool status = trainingInfo.InsertTrainingDetails(trainer); if (status) { return(Request.CreateResponse(HttpStatusCode.Created, trainer)); } else { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Cannot Insert data May be invalid input")); } } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex)); } }