Esempio n. 1
0
        public async Task<UserAccount> UpdateAsync(UserAccount userAccount)
        {
            using (var uow = _uowFac.Create())
            {
                uow.UserAccountRepository.Update(userAccount);
                await uow.SaveChangesAsync();

                return userAccount;
            }
        }
Esempio n. 2
0
        public async Task<UserAccount> InsertAsync(UserAccount userAccount)
        {
            using (var uow = _uowFac.Create())
            {
                userAccount.Id = Guid.NewGuid().ToString();

                uow.UserAccountRepository.Insert(userAccount);
                await uow.SaveChangesAsync();

                return userAccount;
            }
        }
Esempio n. 3
0
        public async Task<IHttpActionResult> PostUserAccount(UserAccount userAccount)
        {
            try
            {
                if (!ModelState.IsValid)
                    return BadRequest(ModelState);

                var result = await _userAccountService.InsertAsync(userAccount);
                return Ok(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
        public async Task<IHttpActionResult> PutUserAccount(UserAccount userAccount)
        {
            try
            {
                if (!ModelState.IsValid)
                    return BadRequest(ModelState);

                if (String.IsNullOrEmpty(userAccount.Id))
                    return BadRequest();

                var result = await _userAccountService.UpdateAsync(userAccount);
                return Ok(result);
            }
            catch (Exception)
            {
                throw;
            }
        }