예제 #1
0
		public ActionResult Decline(int appraiserOrderId)
		{
			if (!CanCurrentUserAcceptOrder(appraiserOrderId))
			{
				return RedirectToAction(NameHelper.Home.Index, NameHelper.Home.Controller, new { area = "" });
			}
			var model = new AppraiserOrderDeclineViewModel()
			{
				AppraiserOrderId = appraiserOrderId,
				IsOrderRespondedByCurrentAppraiser = _appraiserOrderDeliveryService.GetIsOrderResponded(appraiserOrderId),
				MinRequiredFee = _appraiserOrderDeliveryService.GetRequiredFee(appraiserOrderId)
			};
			return View("AppraiserOrder/Decline", model);
		}
예제 #2
0
		public ActionResult Decline(AppraiserOrderDeclineViewModel model)
		{
			if (ModelState.IsValid)
			{
				if ( model.Reason == (int)OrderDeclineReasonType.InsufficientFee && !_appraiserOrderDeliveryService.RequiredFeeIsValid(model.AppraiserOrderId, model.RequiredFee.Value))
					return View("AppraiserOrder/Decline", model);

				int? reason = null;
				if (model.Reason > 0)
				{
					reason = model.Reason;
				}
				var fee = model.Reason == (int)OrderDeclineReasonType.InsufficientFee ? model.RequiredFee : null;
				_appraiserOrderDeliveryService.DeclineOrder(model.AppraiserOrderId, reason, fee);
				CommitProviderInstance.Commit();

				if (new RoleType[] { RoleType.DvsAdmin, RoleType.DvsDisbursementsProcessor, RoleType.DvsSuperAdmin }.Contains(SecurityContext.CurrentUser.PrimaryRole.RoleType))
				{
					return RedirectToAction(NameHelper.Dashboard.DVSUserDashboard.Index, NameHelper.Dashboard.DVSUserDashboard.Controller, new { Area = NameHelper.Dashboard.Area });
				}
				return RedirectToAction(NameHelper.Dashboard.HotList.Index, NameHelper.Dashboard.HotList.Controller, new { Area = NameHelper.Dashboard.Area });
			}
			return View("AppraiserOrder/Decline", model);
		}