Example #1
0
        public async Task Put(LoginDTO item)
        {
            using (var repo = new LoginRepository())
            {
                Login existing = await repo.GetById(item.Id);

                if (existing == null)
                {
                    throw new HttpResponseException(HttpStatusCode.NotFound);
                }
                item.Save(existing);
                await repo.Commit();
            }
        }
Example #2
0
        public async Task <int> Post(LoginDTO item)
        {
            using (var repo = new LoginRepository())
            {
                Login login = new Login();
                item.Save(login);

                await repo.Create(login);

                await repo.Commit();

                return(login.Id);
            }
        }