Ejemplo n.º 1
0
        public async Task <IActionResult> Post([FromBody] BirthdayAddRequest birthdayAddRequest)
        {
            await m_birthdayQuery.AddBirthday(
                new BirthAddDto
            {
                Name     = birthdayAddRequest.Name,
                Location = birthdayAddRequest.Location,
                Day      = birthdayAddRequest.Date.Day,
                Month    = birthdayAddRequest.Date.Month,
                Year     = birthdayAddRequest.Date.Year,
            });

            return(StatusCode(200));
        }
Ejemplo n.º 2
0
        public async Task OnPostBirthday(string location, string name, int day, int month, int year)
        {
            try
            {
                var dt = new DateTime(year, month, day); // Verify date..
                dt.IsDaylightSavingTime();               //keep object.
            }
            catch (Exception exception)
            {
                throw new InvalidEnumArgumentException("Invalid year/month/day");
            }

            await m_birthdayQuery.AddBirthday(
                new BirthAddDto
            {
                Month    = month,
                Day      = day,
                Year     = year,
                Name     = name,
                Location = location
            });
        }