Пример #1
0
        public LogisticService Add(LogisticService logisticService)
        {
            _context.LogisticServiceItems.Add(logisticService);
            _context.SaveChanges();

            return(logisticService);
        }
Пример #2
0
        public LogisticService Delete(int id)
        {
            LogisticService logisticService = _context.LogisticServiceItems.Find(id);

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

            return(logisticService);
        }
Пример #3
0
        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);
        }
Пример #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));
        }
Пример #5
0
 public ActionResult <LogisticService> Add(LogisticService logisticService)
 {
     return(_logisticServiceRepo.Add(logisticService));
 }
Пример #6
0
 public decimal GetCost(LogisticService logisticService, int origin, int destination, int weight)
 {
     return(logisticService.ROMargin + GetCostRO(origin, destination, weight));
 }