// POST api/log public HttpResponseMessage Post([FromBody] SecurityLinkRequest data) { try { var logProfile = _logManager.ModelReader.GetLogProfile(data.LogProfileId); if (logProfile == null) { throw new ArgumentException("Profile not found"); } _logManager.SecurityLinkCommands.SetNewShareLink(data.LogProfileId); _logManager.Save(); logProfile = _logManager.ModelReader.GetLogProfile(data.LogProfileId); return(Request.CreateResponse(HttpStatusCode.Created, new SecurityLinkResponse { LogProfileId = data.LogProfileId, Link = BuildSecurityLink(logProfile.SecurityLink.Link) })); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.GetBaseException())); } }
public HttpResponseMessage Get([FromUri] SecurityLinkRequest data) { try { var logProfile = _logManager.ModelReader.GetLogProfile(data.LogProfileId); if (logProfile == null) { throw new ArgumentException("Profile not found"); } if (logProfile.SecurityLink == null) { return(Request.CreateResponse(HttpStatusCode.Accepted, string.Empty)); } return(Request.CreateResponse(HttpStatusCode.Accepted, new SecurityLinkResponse { LogProfileId = data.LogProfileId, Link = BuildSecurityLink(logProfile.SecurityLink.Link) })); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.GetBaseException())); } }