コード例 #1
0
        private void AssignReviewAndTasksToOIM(RigOapChecklist checklist)
        {
            string oimPassport = adminCustomRepository.GetByName("OIM")?.Value;
            var    oimUser     = peopleService.GetByLogin(oimPassport);

            if (oimPassport != null && oimUser != null)
            {
                irmaTaskService.Add(new IrmaTask()
                {
                    Source           = "Oap",
                    SourceId         = checklist.Id.ToString(),
                    SourceUrl        = string.Format("/Oap/MasterOversight/List/{0}", checklist.Id), // Needs improvement - Does not have access to the MVC routing from the api
                    AssigneeId       = oimUser.Id,
                    Comment          = string.Format("Master Oversight checklist {0} has been submitted and is available for your review", checklist.RigChecklistUniqueId),
                    AssignedDateTime = DateTime.UtcNow,
                    Status           = "Open"
                });

                int rigId;
                reviewService.Add(new IrmaReview()
                {
                    ReviewerPassportId = oimUser.Id,
                    //  RigId = rigId,
                    SourceForm   = "Oap",
                    SourceFormId = checklist.Id.ToString(),
                });
            }
        }
コード例 #2
0
        public JsonResult RequestToReview(Review review)
        {
            review.FromAccount = (int)Session["userID"];
            review.ReviewDate  = DateTime.Now;
            _reviewService.Add(review);

            return(Json(GetReviews(review.DiaryID), JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Comment,RatingId")] ReviewViewModel review)
        {
            if (ModelState.IsValid)
            {
                _service.Add(review);
                return(RedirectToAction(nameof(Index)));
            }

            return(View(review));
        }
コード例 #4
0
 public ActionResult Add(Review review, string returnUrl = null)
 {
     ViewBag.returnUrl = returnUrl ?? Url.Content("~/");
     review            = _reviewService.SetValues(review, _userService.GetLoggedInUserId().Value);
     if (ModelState.IsValid)
     {
         var errors = _reviewService.ValidateReview(review);
         if (!errors.Any())
         {
             _reviewService.Add(review);
             if (returnUrl != null)
             {
                 return(Redirect(returnUrl));
             }
             return(RedirectToAction("Manage"));
         }
         ModelState.Merge(errors);
     }
     ViewBag.GameId = _gameService.GetAllActive().ToList();
     return(View(review));
 }
コード例 #5
0
 public IActionResult Post([FromBody] Review review)
 {
     try
     {
         return(Ok(_reviewService.Add(review).ToApiModel()));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("AddReview", ex.Message);
         return(BadRequest(ModelState));
     }
 }
コード例 #6
0
 public IActionResult Post([FromBody] ReviewModel reviewModel)
 {
     try
     {
         var Review = _reviewService.Add(reviewModel.ToDomainModel());
         return(Ok(Review));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("PostReview", ex.Message);
         return(BadRequest(ModelState));
     }
 }
コード例 #7
0
 public IHttpActionResult Post(ReviewDTO review)
 {
     if (review != null)
     {
         review.Flick = _flickService.FindBy(flck => flck.Id == review.Flick_Id).FirstOrDefault();
         if (review.Flick != null)
         {
             review.Flick.Id = review.Flick_Id;
             _reviewService.Add(review);
             return(Ok());
         }
     }
     return(BadRequest());
 }
コード例 #8
0
        public ActionResult Create(ReviewViewModel reviewViewModel, long filmId)
        {
            reviewViewModel.FilmId            = filmId;
            reviewViewModel.ApplicationUserId = User.Identity.GetUserId();
            reviewViewModel.ReviewDate        = DateTime.Now;
            ModelState.Remove("ReviewDate");
            if (!ModelState.IsValid)
            {
                return(View(reviewViewModel));
            }
            ReviewDomainModel reviewDomainModel = Mapper.Map <ReviewViewModel, ReviewDomainModel>(reviewViewModel);

            _reviewService.Add(reviewDomainModel);
            return(RedirectToAction("Details", "Home", new { filmId = filmId }));
        }
コード例 #9
0
 public ActionResult AddAReview(ReviewSubmissionViewModel reviewForm)
 {
     // Invoke the ReviewService to add the submission
     try
     {
         var model = _reviewService.Add(reviewForm);
         //Loyalty Program: Add Points and Number Of Reviews
         _loyaltyService.AddNumberOfReviews();
         AddActivity(reviewForm.ProductCode, reviewForm.Rating, reviewForm.Nickname);
         return(PartialView("_ReviewItem", model));
     }
     catch (Exception e)
     {
         return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, e.Message));
     }
 }
コード例 #10
0
        public IActionResult Add(AddEditReviewViewModel model)
        {
            if (ModelState.IsValid)
            {
                string currentUserId = GetCurrentUserId();

                _reviewService.Add(new ReviewDTO()
                {
                    ApplicationUserId = currentUserId,
                    Content           = model.Content
                });

                _loggerService.LogInformation(CONTROLLER_NAME + LoggerConstants.ACTION_ADD, LoggerConstants.TYPE_POST, $"add review id {model.Id} successful", GetCurrentUserId());

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
コード例 #11
0
ファイル: ReviewController.cs プロジェクト: dvbtham/NetPet
        public ActionResult Create(ReviewViewModel viewModel)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Json(new
                    {
                        status = false,
                        msg = "Dữ liệu đầu vào không hợp lệ! Kiểm tra lại."
                    }));
                }

                var userId = User.Identity.GetUserId();

                var review = new Review
                {
                    CustomerId = userId,
                    ProductId  = viewModel.ProductId,
                    Content    = viewModel.Content,
                    Rating     = viewModel.Rating
                };

                reviewService.Add(review);
                reviewService.SaveChanges();

                return(Json(new
                {
                    status = true,
                    msg = "Đánh giá thành công."
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    status = false,
                    msg = ex.Message
                }));
            }
        }
コード例 #12
0
        public async Task <IActionResult> AddReview(int?id)
        {
            int     BookId      = id ?? default(int);
            var     book        = _bookService.Get(BookId);
            String  description = Request.Query["description"];
            String  rate        = Request.Query["rate"].ToString();
            Decimal rateA       = Decimal.Parse(rate);
            Review  entity      = new Review {
                Description = description, Rate = rateA, Book = book
            };

            try
            {
                await _reviewService.Add(entity);
            }
            catch (DbUpdateException e)
            {
                RedirectToAction(nameof(Index));
            }
            return(RedirectToAction(nameof(Index)));
        }
コード例 #13
0
        public async Task <ActionResult <ReviewItem> > PostReviewItem(ReviewItem reviewItem)
        {
            if (_reviewService.ReviewItemExists(reviewItem.Id))
            {
                ModelState.AddModelError("", "Item already exists");
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var saved = await _reviewService.Add(reviewItem);

            if (saved == 0)
            {
                ModelState.AddModelError("", "Please select a valid rating");
                return(BadRequest(ModelState));
            }

            return(CreatedAtAction("GetReviewItem", new { id = reviewItem.Id }, reviewItem));
        }
コード例 #14
0
        public ShopMutations(ISupplierRepository supplierRepository, IProductRepository productRepository, IReviewService reviewService)
        {
            _reviewService = reviewService;

            FieldAsync <ProductType>(
                "createProduct",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ProductInput> >
            {
                Name = "productInput"
            }
                    ),
                resolve: async context =>
            {
                var product        = context.GetArgument <Product>("productInput");
                product.SupplierId = 1;
                // .. validazione ..
                return(await productRepository.Add(product));
            }
                );

            Field <ReviewType>(
                "createReview",
                arguments: new QueryArguments(
                    new QueryArgument <NonNullGraphType <ReviewInput> >
            {
                Name = "reviewInput"
            }
                    ),
                resolve: context =>
            {
                var review = context.GetArgument <Review>("reviewInput");
                var rev    = reviewService.Add(review);
                return(rev);
            }
                );
        }
コード例 #15
0
 public void Post(ReviewViewModel review)
 {
     _reviewService.Add(review);
     _reviewService.SaveChanges();
 }
コード例 #16
0
        public async Task <IHttpActionResult> Post(ReviewDTO review)
        {
            await _reviewService.Add(ReviewDTO.MapToBusContract(review));

            return(Ok());
        }
コード例 #17
0
 public ActionResult Post([FromBody] NewReviewDto value)
 {
     _reviewService.Add(value);
     return(Ok());
 }
コード例 #18
0
        public ActionResult AddAReview(ReviewSubmissionViewModel reviewForm)
        {
            _reviewService.Add(reviewForm);

            return(RedirectToAction("Index"));
        }