public HttpResponseMessage CreateCompany([FromBody] Company company) { HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); if (company == null) { response = new HttpResponseMessage(HttpStatusCode.BadRequest); response.Content = new StringContent(EngineData.modeloImcompleto, Encoding.Unicode); return(response); } bool resultado = Tool.EmailEsValido(company.Email); if (!resultado) { response = new HttpResponseMessage(HttpStatusCode.InternalServerError); response.Content = new StringContent(EngineData.emailNoValido, Encoding.Unicode); return(response); } company.Codigo = Tool.ConstruirCodigo(); resultado = Metodo.CreateCompany(company); if (!resultado) { response.Content = new StringContent(EngineData.falloCrearCompany, Encoding.Unicode); } else { Notificacion.EnviarEmail(company.Email, company.Codigo, company.NameCompany); response.Content = new StringContent(EngineData.transaccionExitosa, Encoding.Unicode); response.Headers.Location = new Uri(EngineData.UrlBase + EngineData.UrlCompany); } return(response); }
public string NoDefinido(string email, IEngineTool Tool) { if (email == "*****@*****.**") { string[] p = email.Split('@'); email = p[0] + Tool.ConstruirCodigo() + "@" + "gmail.com"; } return(email); }