コード例 #1
0
        public async Task <ActionResult> Create(CreatePersonModel person)
        {
            string userId = Session["userId"].ToString();

            if (string.IsNullOrWhiteSpace(person.FirstName))
            {
                return(View());
            }

            if (person.DateCreated is null)
            {
                person.DateCreated = System.DateTime.Now;
            }

            var updatedCount = await _personOrchestrator.CreatePerson(new PersonViewModel
            {
                PersonId    = Guid.Parse(userId),
                FirstName   = person.FirstName,
                LastName    = person.LastName,
                DateCreated = person.DateCreated,
                Email       = person.Email,
                Gender      = person.Gender,
                PhoneNumber = person.PhoneNumber
            });

            return(View());
        }
コード例 #2
0
        public async Task <ActionResult> CreatePerson(CreatePersonModel person)
        {
            string userId = Session["userId"].ToString();

            var updatedCount = await _personOrchestrator.CreatePerson(new PersonViewModel
            {
                PersonId    = Guid.Parse(userId),
                FirstName   = person.FirstName,
                LastName    = person.LastName,
                Gender      = person.Gender,
                DateCreated = person.DateCreated,
                Email       = person.Email,
                PhoneNumber = person.PhoneNumber
            });

            return(Json(updatedCount, JsonRequestBehavior.AllowGet));
        }