Exemplo n.º 1
0
        public override IActionResult PostEntity(RecordModel model)
        {
            if (_fuelCardRepository.GetById((int)model.FuelCardId) == null)
            {
                return(NotFound($"Tankkaart met id {model.FuelCardId} niet gevonden"));
            }

            if (_corporationRepository.GetById((int)model.CorporationId) == null)
            {
                return(NotFound($"Vennootschap met id {model.CorporationId} niet gevonden"));
            }

            if (_costAllocationRepository.GetById((int)model.CostAllocationId) == null)
            {
                return(NotFound($"Kosten allocatie met id {model.CostAllocationId} niet gevonden"));
            }

            if (_recordRepository.Find(r => r.FuelCard.Id == model.FuelCardId).FirstOrDefault() != null)
            {
                return(BadRequest($"Een dossier met tankkaart id {model.FuelCardId} bestaat al"));
            }

            return(base.PostEntity(model));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 依据id查询
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Corporation GetById(int id)
 {
     return(repository.GetById(id));
 }
Exemplo n.º 3
0
        public void Customer_Reposiroty_Get_By_Id()
        {
            var customer = repo.GetById(10);

            Assert.True(customer != null);
        }