예제 #1
0
        public async Task <IActionResult> Delete(Guid id)
        {
            if (ManagedYearPlan == null)
            {
                return(ActionIfNotChoosedManagedYearPlan());
            }

            var @operator = await _operatorRepository.GetById(id);

            await _operatorRepository.Delete(@operator);

            return(RedirectToAction("Index"));
        }
        public int Delete(Operator obj)
        {
            var result = 0;

            if (obj == null)
            {
                throw new NullReferenceException("Object yang ingin dihapus tidak bisa null.");
            }

            if (obj.id == 1 || obj.login_id.Equals("admin"))
            {
                return(-1);
            }

            using (IDapperContext context = new DapperContext())
            {
                _repository = new OperatorRepository(context);
                result      = _repository.Delete(obj);
            }

            return(result);
        }
예제 #3
0
 public async Task Delete(int id)
 {
     await _operatorRepository.Delete(id);
 }