コード例 #1
0
        public async Task <IActionResult> Edit(CxcCustomer Customer)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    // TODO: Pending to change to: this.User.Identity.Name
                    Customer.User = await _userHelper.GetUserByEmailAsync("*****@*****.**");

                    Customer.IdSex     = 1;
                    Customer.BirthDate = DateTime.UtcNow;
                    await _customerRepository.UpdateAsync(Customer);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!await _customerRepository.ExistAsync(Customer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View(Customer));
        }
コード例 #2
0
        public async Task <IActionResult> Create(CxcCustomer Customer)
        {
            if (ModelState.IsValid)
            {
                var company = await _companyRepository.GetCompany(1);

                // TODO: Pending to change to: this.User.Identity.Name
                Customer.User = await _userHelper.GetUserByEmailAsync("*****@*****.**");

                Customer.IdType = company.IdType;
                await _customerRepository.CreateAsync(Customer);

                return(RedirectToAction(nameof(Index)));
            }

            return(View(Customer));
        }