예제 #1
0
		public JsonResult Add(AddRiskForm form)
		{
			var customer = _context.Customers.Include(x => x.Risks).Single(x => x.Id == form.CustomerId);

			var risk = Mapper.Map<Risk>(form);

			customer.Risks.Add(risk);

			_context.SaveChanges();

			var model = Mapper.Map<CustomerRiskViewModel>(risk);

			return BetterJson(model);
		}
예제 #2
0
        public JsonResult Add(AddRiskForm form)
        {
            var customer = _context.Customers.Include(x => x.Risks).Single(x => x.Id == form.CustomerId);

            var risk = Mapper.Map <Risk>(form);

            customer.Risks.Add(risk);

            _context.SaveChanges();

            var model = Mapper.Map <CustomerRiskViewModel>(risk);

            return(BetterJson(model));
        }