Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Birthdate,City,State")] Person person)
        {
            _context.Add(person);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
Ejemplo n.º 2
0
        public void CreateExceptionRecord(CreateExceptionLogCommand cmd)
        {
            var exceptionLogRecord = new ExceptionLog
            {
                LogTime             = cmd.LogTime,
                HttpStatusCode      = cmd.HttpStatusCode,
                RequestId           = cmd.RequestId,
                ExceptionMessage    = cmd.ExceptionMessage,
                ExceptionStackTrace = cmd.ExceptionStackTrace
            };

            _personAccomplishmentContext.Add(exceptionLogRecord);
            _personAccomplishmentContext.SaveChanges();
        }
Ejemplo n.º 3
0
        public int CreatePerson(CreatePersonCommand cmd)
        {
            var person = new Person
            {
                FirstName = cmd.FirstName,
                LastName  = cmd.LastName,
                Birthdate = cmd.Birthdate,
                City      = cmd.City,
                State     = cmd.State,
                // Accomplishments = cmd.Accomplishments?.Select(i => new Accomplishment
                // {
                //     Name = i.Name,
                //    DateOfAccomplishment = i.DateOfAccomplishment,
                // }).ToList()
            };

            _personAccomplishmentContext.Add(person);
            _personAccomplishmentContext.SaveChanges();

            return(person.Id);
        }