Exemple #1
0
        public async Task <decimal> RequestPriceCost(PriceCostDto priceCostDto)
        {
            return(await Task.Run <decimal>(() =>
            {
                return _APIConsume.CalculatePriceCost(priceCostDto);
            }
                                            ));

            // decimal PriceCost = financialservice.CalculatePriceCost(priceCostDto);
            //await Clients.User(User).ReciveTripCost(PriceCost);
        }
Exemple #2
0
 public PriceCostBl(PriceCostDto dto)
 {
     if (dto != null)
     {
         Id        = dto.Id;
         Type      = dto.Type;
         Procedure = dto.Procedure;
         Value     = dto.Value;
         DateEnd   = dto.DateEnd;
     }
 }
 public ActionResult <PriceCostDto> Add([FromBody] PriceCostDto dto)
 {
     try
     {
         var item = _bl.Add(dto);
         return(CreatedAtRoute("GetPriceCostById", new { Id = item.Id }, item));
     }
     catch (Exception ex)
     {
         return(Conflict(ex.Message));
     }
 }
Exemple #4
0
        public PriceCostDto Add(PriceCostDto dto)
        {
            var item = new PriceCost()
            {
                Procedure = dto.Procedure,
                Type      = dto.Type,
                Value     = dto.Value,
                DateEnd   = dto.DateEnd,
            };

            _dao.Create(item);
            return(_map(item));
        }
 public ActionResult <PriceCostDto> Update([FromBody] PriceCostDto dto)
 {
     try
     {
         return(_bl.Update(dto));
     }
     catch (KeyNotFoundException ex)
     {
         return(NotFound(ex.Message));
     }
     catch (Exception ex)
     {
         return(Conflict(ex.Message));
     }
 }
Exemple #6
0
        // to CalculatePriceCost
        public decimal CalculatePriceCost(PriceCostDto pricecost)
        {
            var request = new RestRequest("Venusera/Financial/CalculateCostPrice/{pricecost}", Method.GET)
            {
                RequestFormat = DataFormat.Json
            };

            request.AddParameter("pricecost", pricecost, ParameterType.UrlSegment);
            var response = client.Execute <decimal>(request);

            if (response.Data == 0)
            {
                throw new Exception(response.ErrorMessage);
            }

            return(response.Data);
        }
Exemple #7
0
        public PriceCostDto Update(PriceCostDto dto)
        {
            var item = _dao.Get(dto.Id);

            if (item == null)
            {
                throw new KeyNotFoundException();
            }

            item.Procedure = dto.Procedure;
            item.Type      = dto.Type;
            item.Value     = dto.Value;
            item.DateEnd   = dto.DateEnd;
            _dao.Update(item);

            return(_map(item));
        }
Exemple #8
0
 public PriceCostDto Update(PriceCostDto item)
 {
     return(Url.AppendPathSegment("pricecost")
            .PutJsonAsync(item).ReceiveJson <PriceCostDto>().Result);
 }