public LogisticService Add(LogisticService logisticService)
        {
            _context.LogisticServiceItems.Add(logisticService);
            _context.SaveChanges();

            return(logisticService);
        }
        public LogisticService Delete(int id)
        {
            LogisticService logisticService = _context.LogisticServiceItems.Find(id);

            if (logisticService != null)
            {
                _context.LogisticServiceItems.Remove(logisticService);
                _context.SaveChanges();
            }

            return(logisticService);
        }
        public LogisticService Update(LogisticService logisticServiceChanges)
        {
            var local = _context.Set <LogisticService>().Local.FirstOrDefault(entry => entry.Id.Equals(logisticServiceChanges.Id));

            if (local != null)
            {
                _context.Entry(local).State = EntityState.Detached;
            }

            _context.Entry(logisticServiceChanges).State = EntityState.Modified;
            _context.SaveChanges();

            return(logisticServiceChanges);
        }
Beispiel #4
0
        public ActionResult <LogisticService> Update(int id, LogisticService logisticService)
        {
            if (id != logisticService.Id)
            {
                return(BadRequest());
            }

            var logisticServiceItem = _logisticServiceRepo.Get(id);

            if (logisticServiceItem == null)
            {
                return(NotFound());
            }

            return(_logisticServiceRepo.Update(logisticService));
        }
Beispiel #5
0
 public ActionResult <LogisticService> Add(LogisticService logisticService)
 {
     return(_logisticServiceRepo.Add(logisticService));
 }
Beispiel #6
0
 public decimal GetCost(LogisticService logisticService, int origin, int destination, int weight)
 {
     return(logisticService.ROMargin + GetCostRO(origin, destination, weight));
 }