Esempio n. 1
0
		public ActionResult AddValueReconsideration(int orderId, ValueReconsiderationViewModel model)
		{
			if (model == null || !model.IsValid)
				return null;

			var result = _conditionsService.AddValueReconsideration(orderId, model);
			CommitProviderInstance.Commit();
			return Json(new { address = result.Address, mls = result.MLSNumber, age = result.Age, gla = result.GLA, prox = result.Prox, baths = result.Baths, beds = result.Beds, comments = result.Comments, propertyId = result.Id });
		}
Esempio n. 2
0
		public OrderReconsiderationProperty AddValueReconsideration(int orderId, ValueReconsiderationViewModel model)
		{
			if (!AllowAddValueReconsideration())
			{
				throw new SecurityException(string.Format("User has no permissions to add or edit value reconsideration record. User id [{0}].", _securityContext.CurrentUser.Id));
			}
			var order = _orderManager.GetOrderById(orderId);
			var property = new OrderReconsiderationProperty();
			model.PopulateOrderReconsiderationProperty(orderId, property);
			if (model.PropertyId.HasValue)
			{
				var propertyToUpdate = order.ReconsiderationProperties.FirstOrDefault(p => p.Id == model.PropertyId);
				if (propertyToUpdate != null)
				{
					propertyToUpdate.Address = model.Address;
					propertyToUpdate.Age = model.Age;
					propertyToUpdate.Baths = model.Baths;
					propertyToUpdate.Beds = model.Beds;
					propertyToUpdate.Comments = model.Comments;
					propertyToUpdate.GLA = model.GLA;
					propertyToUpdate.Prox = model.Prox;
					propertyToUpdate.MLSNumber = model.MLSNumber;
				}
			}
			else
			{
				order.ReconsiderationProperties.Add(property);
				_orderHistoryManager.AddReconsiderationPropertyNote(orderId, property.Address);
			}
			_notificationManager.SheduleOrderPeriodicalNotifications(order, OrderPeriodicalNotificationType.ValueReconsiderationCreated);

			return property;
		}