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)); }
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)); }
public void Edit(BuisnessAreaEntity entity) { GetById(entity.Id); _context.BuisnessAreas.Update(entity); }
public void Delete(BuisnessAreaEntity entity) { _context.BuisnessAreas.Remove(entity); }
public void Add(BuisnessAreaEntity entity) { _context.BuisnessAreas.Add(entity); }