public void WorkTheBusiness(WorkingBusinessModelView viewModel)
        {
            viewModel.Name     = this.Name;
            viewModel.IsOpened = this.IsOpened;

            if (this.Capacity < viewModel.Capacity)
            {
                this.Capacity = viewModel.Capacity;
            }
            this.CurrentCapacity = viewModel.CurrenCapacity;
        }
        public LifeInfo CreateLifeInfo(WorkingBusinessModelView viewModel)
        {
            LifeInfo lifeInfo = new LifeInfo()
            {
                RestaurantID    = viewModel.Id,
                CurrentCapacity = viewModel.CurrenCapacity,
                DateTimeSaved   = DateTime.Now
            };

            return(lifeInfo);
        }
        public ActionResult EnterTheBusiness(WorkingBusinessModelView viewModel)
        {
            var userId     = User.Identity.GetUserId();
            var restaurant = unitOfWork.Businesses.GetRestaurant(viewModel.Id, userId);

            restaurant.WorkTheBusiness(viewModel);
            unitOfWork.Complete();
            var lifeInfo = restaurant.CreateLifeInfo(viewModel);

            unitOfWork.LifeInfos.AddLifeInfo(lifeInfo);
            unitOfWork.Complete();
            return(View("EnterTheBusiness", viewModel));
        }
        public WorkingBusinessModelView CreateWorkingBusinessModelView()
        {
            var viewModel = new WorkingBusinessModelView()
            {
                Id             = this.ID,
                Name           = this.Name,
                Capacity       = this.Capacity,
                Category       = this.Category.Name,
                Area           = this.Area.Name,
                Location       = this.Location.Name,
                StreetName     = this.StreetName,
                StreetNumber   = this.StreetNumber,
                Lattitude      = this.Lattitude,
                Longitude      = this.Longitude,
                PostalCode     = this.PostalCode,
                CurrenCapacity = this.CurrentCapacity,
                IsOpened       = this.IsOpened,
                PhoneNumber    = this.PhoneNumber
            };

            return(viewModel);
        }