public IActionResult Get(Guid visitId)
        {
            var servicesInVisit = new List <ServiceInVisit>();

            try
            {
                servicesInVisit.AddRange(_serviceInVisitCrudService.GetInVisit(visitId));
            }
            catch (ServiceOperationException exception)
            {
                ViewBag.Error = ErrorFactory.IdentifyExceptionByType(exception).Description;
            }
            ViewBag.VisitId = visitId;
            var visit = _crudService.Get(visitId);

            ViewBag.TotalCost = visit.TotalCost;
            ViewBag.Date      = visit.DateOfVisit;
            return(View(servicesInVisit));
        }
Exemple #2
0
        private void UpdateAllTotalCost()
        {
            var visits = _visitCrudService.GetAll();

            foreach (var visit in visits)
            {
                visit.TotalCost = _serviceInVisitCrudService.GetInVisit(visit.Id).Sum(y => y.MasterServices.Service.Price);
                _visitCrudService.Update(visit);
            }
        }