public IActionResult Create([FromBody] RegisteredUser registeredUser) { try { ContactInfoCore contactInfoCore = new ContactInfoCore(dbContext); ContactInfo newContactInfo = new ContactInfo(); newContactInfo.Facebook = ""; newContactInfo.Instagram = ""; newContactInfo.WebPage = ""; newContactInfo.Twitter = ""; newContactInfo.YouTube = ""; contactInfoCore.Create(newContactInfo); ContactInfo lastCI = contactInfoCore.GetLastRegistered(); registeredUser.IdContactInfo = lastCI.Id; RegisteredUserCore registeredUserCore = new RegisteredUserCore(dbContext); registeredUserCore.Create(registeredUser); return(Ok("registeredUser Added Succesfully")); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex)); } }
public IActionResult GetAll() { try { ContactInfoCore contactInfoCore = new ContactInfoCore(dbContext); return(Ok(contactInfoCore.GetAll())); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex)); } }
public IActionResult Delete([FromRoute] int id) { try { ContactInfoCore contactInfoCore = new ContactInfoCore(dbContext); contactInfoCore.Delete(id); return(Ok("Contact Info Deleted Succesfully")); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex)); } }
public IActionResult Create([FromBody] ContactInfo contactInfo) { try { ContactInfoCore contactInfoCore = new ContactInfoCore(dbContext); contactInfoCore.Create(contactInfo); return(Ok("Contact Info Added Succesfully")); } catch (Exception ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex)); } }