Beispiel #1
0
        public IActionResult Post([FromBody] DerogationHeaders derogationheader)
        {
            var entity = _ctx.DerogationHeaders.Add(derogationheader);

            _ctx.SaveChanges();

            var lastId = _ctx.DerogationHeaders.OrderByDescending(h => h.DerogationId).First();

            return(Ok(lastId.DerogationId));
        }
Beispiel #2
0
        public IActionResult Delete(int id)
        {
            var order = _ctx.DerogationHeadersItems.FirstOrDefault(t => t.Id == id);

            if (order == null)
            {
                return(NotFound());
            }

            _ctx.DerogationHeadersItems.Remove(order);
            _ctx.SaveChanges();
            return(new NoContentResult());
        }
Beispiel #3
0
        public IActionResult Delete(int Id)
        {
            var order = _ctx.InternetLinks.FirstOrDefault(t => t.Id == Id);

            if (order == null)
            {
                return(NotFound());
            }

            _ctx.InternetLinks.Remove(order);
            _ctx.SaveChanges();
            return(new NoContentResult());
        }
        public IActionResult UpdateUser(int id, [FromBody] TblUser di)
        {
            var entity = _ctx.TblUser.FirstOrDefault(e => e.UserId == id);

            if (entity == null)
            {
                return(BadRequest("Item was mot found "));
            }
            else
            {
                entity.FullName = di.FullName;
                entity.Email    = di.Email;
                entity.position = di.position;
                _ctx.SaveChanges();
                return(Ok(entity));
            }
        }
Beispiel #5
0
        public IActionResult register([FromBody] TblUser user, string Password)
        {
            byte[] passwordHash, passwordSalt;

            // sprawdzenie czy istniej już użytkownik .

            if (_ctx.TblUser.Any(x => x.FullName == user.FullName))
            {
                return(BadRequest("User already exist "));
            }

            CreatePasswordHashSalt(Password, out passwordHash, out passwordSalt);
            user.PasswordHash = passwordHash;
            user.PasswordSalt = passwordSalt;

            _ctx.TblUser.Add(user);
            _ctx.SaveChanges();
            return(Ok());;
        }