コード例 #1
0
        public IActionResult Post([FromBody] BuisnessAreaEntity value)
        {
            var currentUser = HttpContext.User.Identity.Name;

            if (!_securityRepository.UserIsAdmin(HttpContext))
            {
                return(_securityRepository.Gate(GateType.Unathorised, AccessLogAction.BACreate, currentUser, _objectType, string.Empty));
            }

            _buisnessAreaRepository.Add(value);
            _securityRepository.LogUserAction(currentUser, AccessLogAction.BACreate, value.Name, _objectType, true);
            _buisnessAreaRepository.SaveChanges();

            return(Ok(value));
        }
コード例 #2
0
        public IActionResult Put(string name, [FromBody] BuisnessAreaEntity value)
        {
            var currentUser = HttpContext.User.Identity.Name;

            if (!_securityRepository.UserIsAdmin(HttpContext))
            {
                return(_securityRepository.Gate(GateType.Unathorised, AccessLogAction.BAUpdate, currentUser, _objectType, name));
            }

            var entity = _buisnessAreaRepository.GetByName(name);

            if (String.IsNullOrWhiteSpace(entity.Name))
            {
                return(_securityRepository.Gate(GateType.NotFound, AccessLogAction.BAUpdate, currentUser, _objectType, name));
            }

            _buisnessAreaRepository.Edit(value);
            _securityRepository.LogUserAction(currentUser, AccessLogAction.BAUpdate, name, _objectType, true);
            _buisnessAreaRepository.SaveChanges();

            return(Ok(value));
        }
コード例 #3
0
 public void Edit(BuisnessAreaEntity entity)
 {
     GetById(entity.Id);
     _context.BuisnessAreas.Update(entity);
 }
コード例 #4
0
 public void Delete(BuisnessAreaEntity entity)
 {
     _context.BuisnessAreas.Remove(entity);
 }
コード例 #5
0
 public void Add(BuisnessAreaEntity entity)
 {
     _context.BuisnessAreas.Add(entity);
 }