public static decimal GetTotalFeedback(RatingModel model) { decimal totalRating; int maxRating = Constants.MAX_RATING; ; totalRating = Math.Ceiling(Convert.ToDecimal((Constants.RATING_FOR_ONTIME * model.OnTime / maxRating + Constants.RATING_FOR_COMMUNICATION * model.Communication / maxRating + Constants.RATING_FOR_UNDERSTANDING * model.UnderStandingOfServiceRequired / maxRating + Constants.RATING_FOR_QUALITY * model.Quality / maxRating + Constants.RATING_FOR_CLEANLINESS * model.Cleanliness / maxRating + Constants.RATING_FOR_CONDUCT * model.Conduct / maxRating) * maxRating / 100)); return totalRating; }
public RatingModel GetRatingByJobId(int JobId) { //unitOfWork.StartTransaction(); RatingRepository repo = new RatingRepository(unitOfWork); RatingModel ratingModel = new RatingModel(); Rating rating = new Rating(); AutoMapper.Mapper.Map(ratingModel, rating); rating = repo.GetAll().Where(x => x.JobId == JobId).FirstOrDefault(); //unitOfWork.Commit(); AutoMapper.Mapper.Map(rating, ratingModel); return ratingModel; }
public IHttpActionResult SaveFeedback(RatingBindingModel model) { try { RatingModel ratingModel = new RatingModel(); AutoMapper.Mapper.Map(model, ratingModel); ratingModel = ratingService.SaveRating(ratingModel); AutoMapper.Mapper.Map(ratingModel, model); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); return BadRequest(ex.Message); } return Json(model); }
public RatingModel GetRatingByServiceProviderId(string ServiceProviderId) { //unitOfWork.StartTransaction(); RatingRepository repo = new RatingRepository(unitOfWork); RatingModel ratingModel = new RatingModel(); Rating rating = new Rating(); AutoMapper.Mapper.Map(ratingModel, rating); //rating = repo.GetAll().Where(x => x. == ServiceProviderId).FirstOrDefault(); //unitOfWork.Commit(); AutoMapper.Mapper.Map(rating, ratingModel); return ratingModel; }
public RatingModel UpadteRating(RatingModel model) { //unitOfWork.StartTransaction(); RatingRepository repo = new RatingRepository(unitOfWork); Rating rating = new Rating(); rating = repo.GetAll().Where(x => x.RatingId == model.RatingId).FirstOrDefault(); AutoMapper.Mapper.Map(model, rating); repo.Update(rating); //unitOfWork.Commit(); AutoMapper.Mapper.Map(rating, model); return model; }
public RatingModel SaveRating(RatingModel model) { //unitOfWork.StartTransaction(); RatingRepository repo = new RatingRepository(unitOfWork); Rating rating = new Rating(); AutoMapper.Mapper.Map(model, rating); repo.Insert(rating); //unitOfWork.Commit(); AutoMapper.Mapper.Map(rating, model); return model; }