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