コード例 #1
0
        //[ValidateAntiForgeryToken]
        public async Task <IActionResult> SignonAggregatorGroup([FromBody] AggregatorGroupRegistModel model)
        {
            if (ModelState.IsValid)
            {
                if (_accountContext.AggregatorGroups.Any(x => x.AggName == model.AggregatorGroupName))
                {
                    IdentityError  error   = (_userManager.ErrorDescriber as LocalizedIdentityErrorDescriber).TargetAggGroupHasAlready(model.AggregatorGroupName);
                    IdentityResult _result = IdentityResult.Failed(error);
                    return(BadRequest(new { Result = _result }));
                }
                AggregatorGroup aggregatorGroup = new AggregatorGroup();
                aggregatorGroup.ID             = Guid.NewGuid().ToString();
                aggregatorGroup.AggName        = model.AggregatorGroupName;
                aggregatorGroup.Representation = model.Represenation;
                aggregatorGroup.Address        = model.Address;
                aggregatorGroup.CreateDT       = DateTime.Now;
                aggregatorGroup.PhoneNumber    = model.PhoneNumber;
                await _accountContext.AddAsync(aggregatorGroup);

                await _accountContext.SaveChangesAsync();

                return(Ok(aggregatorGroup.ID));
            }
            return(BadRequest());
        }
コード例 #2
0
ファイル: AccountRepo.cs プロジェクト: kaishi12/SalonProduct
        public async Task <Domain.Entity.Account> AddAsync(Domain.Entity.Account model)
        {
            try
            {
                await _context.AddAsync(model);

                await _context.SaveChangesAsync();

                return(model);
            }
            catch
            {
                throw new TimeoutException("Conversion to a DateTime is not supported.");
            }
        }