Пример #1
0
        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));
            }
        }
Пример #2
0
        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));
            }
        }