public CarController() { myService = new ServiceCar(); serviceSubCategory = new ServiceSubCategory(); serviceCarModel = new ServiceCarModel(); serviceCreation = new ServiceCreationYear(); serviceType = new ServiceTypeCar(); serviceImage = new ServiceImage(); serviceRating = new ServiceRating(); }
public HomeClientController() { myService = new ServiceCategory(); serviceCountry = new ServiceCountry(); serviceState = new ServiceState(); serviceCategory = new ServiceCategory(); serviceSubCategory = new ServiceSubCategory(); serviceCar = new ServiceCar(); serviceRating = new ServiceRating(); serviceUser = new ServiceUser(); }
public bool ProcessVote(AnswerBm bm, string appUserId) { var vsEntity = this.vehicleService.GetVehiceService(bm.Id); if (vsEntity == null) { return(false); } var serviceRating = vsEntity.ServiceRatings.FirstOrDefault(x => x.VehicleServiceId == vsEntity.Id && !x.IsDeleted && x.User.ApplicationUserId == appUserId); var user = this.userService.GetUserByAppId(appUserId); if (user == null) { return(false); } if (serviceRating != null) { serviceRating.IsDeleted = true; var isUpdated = this.vehicleService.Update(); if (!isUpdated) { return(false); } } var newServiceRating = new ServiceRating() { VehicleService = vsEntity, VehicleServiceId = vsEntity.Id, User = user, UserId = user.Id, IsPositive = bm.IsAccepted, Message = bm.Message }; vsEntity.ServiceRatings.Add(newServiceRating); bool isAdded = this.vehicleService.AddServiceRating(newServiceRating); if (!isAdded) { return(false); } return(true); }
public bool AddServiceRating(ServiceRating serviceRating) { try { this.context.ServiceRatings.Add(serviceRating); this.context.Commit(); } catch (Exception ex) { return(this.LogError(ex)); } return(true); }
public async Task <CommandResult <ServiceRatingViewModel> > ExecuteAsync(ServiceRatingViewModel serviceRatingViewModel) { var getUserId = _httpContextAccessor.HttpContext.User.Identity.Name; var userName = _userManager.FindByIdAsync(getUserId).Result.UserName; try { //Check provider has available var getService = await _serviceRepository.FindByIdAsync(Guid.Parse(serviceRatingViewModel.ServiceId)); if (getService == null) { await Logging <AddUpdateRatingServiceCommand> .WarningAsync(ActionCommand.COMMAND_ADD, userName, ErrorMessageConstant.ERROR_CANNOT_FIND_ID); return(new CommandResult <ServiceRatingViewModel> { isValid = false, errorMessage = ErrorMessageConstant.ERROR_CANNOT_FIND_ID }); } var getServiceRating = await _serviceRatingRepository.FindSingleAsync(x => x.ServiceId == Guid.Parse(serviceRatingViewModel.ServiceId) && x.UserId == Guid.Parse(serviceRatingViewModel.UserId)); if (getServiceRating != null) { var getUserService = _getOwnServiceInformationQuery.ExecuteAsync(serviceRatingViewModel.ServiceId); getServiceRating.NumberOfRating = serviceRatingViewModel.NumberOfRating; getServiceRating.DateModified = DateTime.Now; _serviceRatingRepository.Update(getServiceRating); await _serviceRatingRepository.SaveAsync(); await LoggingUser <AddUpdateRatingServiceCommand> . InformationAsync(getUserId, userName, userName + "rated" + getService.ServiceName + " with" + getServiceRating.NumberOfRating); await Logging <AddUpdateRatingServiceCommand> .InformationAsync(ActionCommand.COMMAND_ADD, userName, JsonConvert.SerializeObject(serviceRatingViewModel)); return(new CommandResult <ServiceRatingViewModel> { isValid = true, myModel = serviceRatingViewModel }); } var query = new ServiceRating { NumberOfRating = serviceRatingViewModel.NumberOfRating, DateCreated = DateTime.Now, ServiceId = Guid.Parse(serviceRatingViewModel.ServiceId), UserId = Guid.Parse(getUserId) }; await _serviceRatingRepository.Add(query); await _serviceRatingRepository.SaveAsync(); await LoggingUser <AddUpdateRatingServiceCommand> . InformationAsync(getUserId, userName, userName + "rated" + getService.ServiceName + " with" + query.NumberOfRating); await Logging <AddUpdateRatingServiceCommand> .InformationAsync(ActionCommand.COMMAND_ADD, userName, JsonConvert.SerializeObject(serviceRatingViewModel)); return(new CommandResult <ServiceRatingViewModel> { isValid = true, myModel = serviceRatingViewModel }); } catch (Exception ex) { await Logging <AddUpdateRatingServiceCommand> . ErrorAsync(ex, ActionCommand.COMMAND_ADD, userName, "Has Error"); return(new CommandResult <ServiceRatingViewModel> { isValid = false, errorMessage = ex.InnerException.Message.ToString() }); } }
public RatingsController() { myService = new ServiceRating(); serviceCar = new ServiceCar(); }
public override string ToString() { return(Name.ToString() + ", " + Address.ToString() + ", " + Phone.ToString() + ", " + Time.ToString() + ", " + Price.ToString() + ", " + Location.ToString() + ", " + Cuisine.ToString() + ", " + FoodRating.ToString() + ", " + ServiceRating.ToString() + ", " + AmbienceRating.ToString() + ", " + ValueRating.ToString() + ", " + OverallRating.ToString() + ", " + OverallPossible.ToString()); }