Пример #1
0
		public void Update(long id, ApplicationSenderModel model)
		{
			var applicationData = _applications.Get(id);

			Map(model, applicationData);

			_editor.Update(id, applicationData);
		}
Пример #2
0
		public void Add(ApplicationSenderModel model, ClientData client, long creatorSenderId)
		{
			var application = new ApplicationEditData
			{
				InsuranceRate = client.InsuranceRate ?? _applications.GetDefaultInsuranceRate(),
				ScotchCostEdited = client.ScotchCostEdited
			};

			Map(model, application);

			Add(application, client.ClientId, creatorSenderId);
		}
Пример #3
0
		public virtual ActionResult Create(long id, ApplicationSenderModel model)
		{
			var clientId = id;

			var client = _clients.Get(clientId);

			if(!ModelState.IsValid)
			{
				BindBagWithClient(client);

				return View(model);
			}

			var senderId = _senders.GetByUserId(_identity.Id);

			if(!senderId.HasValue)
			{
				throw new EntityNotFoundException("Current user is not sender.");
			}

			_manager.Add(model, client, senderId.Value);

			return RedirectToAction(MVC.ApplicationList.Index());
		}
Пример #4
0
		public virtual ActionResult Edit(long id, ApplicationSenderModel model)
		{
			if(!ModelState.IsValid)
			{
				BindBag(id);

				return View(model);
			}

			_manager.Update(id, model);

			return RedirectToAction(MVC.SenderApplication.Edit(id));
		}
Пример #5
0
		private static void Map(ApplicationSenderModel from, ApplicationEditData to)
		{
			to.Count = from.Count;
			to.FactoryName = from.FactoryName;
			to.Weight = from.Weight;
			to.Invoice = from.Invoice;
			to.MarkName = from.MarkName;
			to.Value = from.Currency.Value;
			to.CurrencyId = from.Currency.CurrencyId;
			to.Volume = from.Volume;
			to.FactureCost = from.FactureCost;
			to.FactureCostEx = from.FactureCostEx;
			to.PickupCost = from.PickupCost;
			to.TransitCost = from.TransitCost;
			to.CountryId = from.CountryId;
			to.AddressLoad = from.AddressLoad;
			to.FactoryContact = from.FactoryContact;
			to.FactoryEmail = from.FactoryEmail;
			to.FactoryPhone = from.FactoryPhone;
			to.WarehouseWorkingTime = from.WarehouseWorkingTime;
			to.CountInInvoce = from.CountInInvoce;
			to.DocumentWeight = from.DocumentWeight;
			to.MRN = from.MRN;
			to.Comments = from.Comments;
		}