// POST: api/EditFaxToEntry public IHttpActionResult Post([FromBody]SendFaxInformation faxEntry) { OperationResult operationResult = new Models.OperationResult(); SendToRepository sendToData = new SendToRepository(); faxEntry.FaxNumber = faxEntry.FaxNumber.Replace("-", "") .Replace(" ", "") .Replace("(", "") .Replace(")", ""); if (faxEntry.Prefix == "Prefix") { faxEntry.Prefix = string.Empty; } if (faxEntry.Suffix == "Suffix") { faxEntry.Suffix = string.Empty; } faxEntry.Name = faxEntry.Prefix + " " + faxEntry.FirstName + " " + faxEntry.LastName + " " + faxEntry.Suffix; operationResult.Success = sendToData.UpdateFaxEntry(faxEntry); if (operationResult.Success) { return Ok(); } else { return BadRequest(); } }
// DELETE: api/EditFaxToEntry/5 public IHttpActionResult Delete(int id) { OperationResult operationResult = new Models.OperationResult(); SendToRepository sendToData = new SendToRepository(); operationResult = sendToData.DeleteFaxEntry(id); if (operationResult.Success) { return Ok(); } else { return BadRequest(); } }
// GET: api/SendTo public IEnumerable<SendFaxInformation> Get() { string filter = System.Web.Http.HttpRequestMessageExtensions.GetQueryString(Request, "filter.filters[0].value"); SendToRepository sendToData = new SendToRepository(); return sendToData.GetAllFaxInformation(filter); }