Example #1
0
 public OperationResult Delete(List <string> bankCode)
 {
     try
     {
         if (bankCode != null)
         {
             int count = _BankRepository.Delete(_BankRepository.Entities.Where(c => bankCode.Contains(c.BankCode)));
             if (count > 0)
             {
                 return(new OperationResult(OperationResultType.Success, "删除数据成功!"));
             }
             else
             {
                 return(new OperationResult(OperationResultType.Error, "删除数据失败!"));
             }
         }
         else
         {
             return(new OperationResult(OperationResultType.ParamError, "参数错误,请选择需要删除的数据!"));
         }
     }
     catch
     {
         return(new OperationResult(OperationResultType.Error, "删除数据失败!"));
     }
 }
        public void TestCRUD()
        {
            Core.Entities.Bank read;
            var b = new Core.Entities.Bank()
            {
                Name = "TestCRUD-" + Guid.NewGuid().ToString()
            };

            repository.Add(b);
            Assert.IsTrue(b.BankId > 0, "BankId not set");

            read = repository.Read(b.BankId);
            Assert.IsNotNull(read);
            Assert.AreEqual(read.BankId, b.BankId);

            b.Name += "-UPDATE";
            repository.Update(b);

            read = repository.Read(b.BankId);
            Assert.IsNotNull(read);
            Assert.AreEqual(read.Name, b.Name);

            repository.Delete(b);

            read = repository.Read(b.BankId);
            Assert.IsNull(read);
        }
Example #3
0
        public void Delete(int id)
        {
            var entity = repository.GetById(id);

            repository.Delete(entity);
            Save();
        }
Example #4
0
 public IActionResult Delete(int id)
 {
     _bankRepository.Delete(new Bank {
         Id = id
     });
     return(RedirectToAction("index"));
 }
Example #5
0
 public Task <bool> Delete(int id)
 {
     return(Task.Run(() =>
     {
         return _bankRepository.Delete(id).Result;
     }));
 }
Example #6
0
        public ActionResult DeleteConfirmed(int id, string confirmText)
        {
            var    bank    = _bankRepository.Find(id);
            var    success = false;
            string error   = "";

            if (bank == null)
            {
                error = "Không tìm thấy ngân hàng";
            }
            else if (confirmText.ToLower() != "đồng ý")
            {
                error = "Chuỗi nhập vào chưa đúng";
            }
            else
            {
                using (new Impersonator("uploaduser", "", "Upload@@123"))
                {
                    string filePath = VITV.Web.Helpers.UrlHelper.GetPhysicalPath(this, bank.Thumbnail);
                    if (System.IO.File.Exists(filePath))
                    {
                        System.IO.File.Delete(filePath);
                    }
                }
                _bankRepository.Delete(id);
                _bankRepository.Save();
                success = true;
            }
            return(Json(new { success = success, id = id, error = error }));
        }
Example #7
0
        public async Task <IActionResult> DeleteBank(int idBank)
        {
            if (await _bankRepository.Delete(idBank))
            {
                return(Ok());
            }

            return(BadRequest());
        }
        public void DeleteBank(int id)
        {
            var bankBranch = _bankBranchRepository.GetList().SingleOrDefault(x => x.BankId == id);

            _bankBranchRepository.Delete(bankBranch);

            var bank = _bankRepository.GetList().Find(id);

            _bankRepository.Delete(bank);
        }
Example #9
0
        public IActionResult DeleteBank(long id)
        {
            Bank a = Bank_repo.Find(id);

            if (a == null)
            {
                return(NotFound());
            }
            Bank_repo.Delete(a);
            return(Ok());
        }
Example #10
0
 public void Delete(string id)
 {
     try
     {
         _repository.Delete(id);
     }
     catch (Exception e)
     {
         _log.Error("Error deleting account: ", e);
         throw;
     }
 }
Example #11
0
        //Delete bank
        public void Delete(int id)
        {
            var getBank = Read(id);

            if (getBank == null)
            {
                Console.WriteLine("Deletion failed, bank not found");
            }
            else
            {
                _bankRepository.Delete(getBank);
                Console.WriteLine("Bank deleted");
            }
        }
        public bool Delete(Guid bankId)
        {
            var  listQuestion   = questionRepository.ListByBankId(bankId);
            var  listQuestionId = listQuestion.Select(x => x.Id).ToList();
            bool deleteQuest    = questionRepository.Delete(listQuestionId);
            bool flag           = true;
            var  listExamId     = examRepository.ListExamIdByBankId(bankId);

            listExamId.ForEach(x =>
            {
                if (!examService.Delete(x))
                {
                    flag = false;
                }
            });

            flag = bankRepository.Delete(bankId) && flag;

            return(flag && deleteQuest);
        }
Example #13
0
 public void Delete(int id)
 {
     _bankRepository.Delete(id);
 }
Example #14
0
 // DELETE: api/Banks/5
 public IHttpActionResult Delete(int id)
 {
     _bankRepository.Delete(id);
     return(Ok());
 }
Example #15
0
 public Bank Delete(Bank deleteBank)
 {
     _bankRepository.Delete(deleteBank);
     return(deleteBank);
 }