private ApiResponse <int> Create(FeedbackViewModel model)
        {
            var apiResp = new ApiResponse <int>
            {
                Type = ResponseType.Fail
            };

            var feedback = new Dto.Feedback
            {
                Email   = model.Email,
                Name    = model.Name,
                Message = model.Message
            };

            var resp = _feedbackBusiness.Add(feedback);

            if (resp.Type != ResponseType.Success)
            {
                apiResp.ErrorCode = resp.ErrorCode;
                return(apiResp);
            }

            apiResp.Type = ResponseType.Success;
            apiResp.Data = feedback.Id;

            return(apiResp);
        }
Beispiel #2
0
        public static DBR.Feedback ToEntity(Dto.Feedback model)
        {
            if (model == null)
            {
                return(null);
            }

            return(new DBR.Feedback
            {
                RestroomId = model.RestroomId,
                Badge = model.Badge,
                FeedbackId = model.FeedbackId,
                FeedbackText = model.FeedbackText,
                Issue = model.Issue,
                InspectionPassed = model.InspectionPassed ?? false,
                NeedAttention = model.NeedsAttention,
                NeedCleaning = model.NeedsCleaning,
                NeedRepair = model.NeedsRepair,
                NeedSupply = model.NeedsSupply,
                Rating = model.Rating,
                Resolution = model.Resolution,
                ReportedAction = model.ReportedAction
            });
        }
Beispiel #3
0
        public async Task <Dto.Feedback> SaveFeedbackAsync(Dto.Feedback feedback)
        {
            var updatedFeedback = await UnitOfWork.SaveFeedbackAsync(Converter.ToEntity(feedback));

            return(Converter.ToModel(updatedFeedback));
        }