Ejemplo n.º 1
0
        public ActionResult PhoneCall(PhoneCallViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                return(View(vm));
            }
            var          title           = _db.Titles.Find(vm.Interaction.TitleId);
            const string interactionType = "Phone Call";
            var          inter           = new Interaction()
            {
                TitleId           = title.Id,
                InteractionDt     = DateTime.Now,
                InteractionUserId = _userManager.GetUserAsync(User).Result.Id.ToString(),
                InteractionType   = interactionType,
                VehYr             = title.VehYr,
                VehMake           = title.VehMake,
                VehModel          = title.VehModel,
                Vin                   = title.Vin,
                TitleState            = title.TitleState,
                IsNew                 = title.NewVeh,
                CustFName             = title.CustFName,
                CustLName             = title.CustLName,
                CustAddr1             = title.CustAddr1,
                CustAddr2             = title.CustAddr2,
                CustCity              = title.CustCity,
                CustState             = title.CustState,
                CustZip               = title.CustZip,
                CustPhone             = vm.Interaction.CustPhone,
                CustPhone2            = vm.Interaction.CustPhone2,
                CustFName2            = title.CustFName2,
                CustLName2            = title.CustLName2,
                CustFName3            = title.CustFName3,
                CustLName3            = title.CustLName3,
                Notes                 = vm.Interaction.Notes,
                TitleRecievedFromType = (Interaction.TitleReceivedFromTypes)title.TitleRecievedFromType
            };

            _db.Interactions.Add(inter);
            _db.SaveChanges();
            title.LastInteraction  = inter.Id;
            _db.Entry(title).State = EntityState.Modified;
            _db.SaveChanges();
            return(RedirectToAction("Details", "Titles", new { id = vm.Interaction.TitleId }));
        }
Ejemplo n.º 2
0
        public ActionResult PhoneCall(int id)
        {
            var          vm              = new PhoneCallViewModel();
            var          title           = _db.Titles.Find(id);
            const string interactionType = "Phone Call";
            var          inter           = new Interaction()
            {
                TitleId           = title.Id,
                InteractionDt     = DateTime.Now,
                InteractionUserId = _userManager.GetUserAsync(User).Result.Id.ToString(),
                InteractionType   = interactionType,
                VehYr             = title.VehYr,
                VehMake           = title.VehMake,
                VehModel          = title.VehModel,
                Vin                   = title.Vin,
                TitleState            = title.TitleState,
                IsNew                 = title.NewVeh,
                CustFName             = title.CustFName,
                CustLName             = title.CustLName,
                CustAddr1             = title.CustAddr1,
                CustAddr2             = title.CustAddr2,
                CustCity              = title.CustCity,
                CustState             = title.CustState,
                CustZip               = title.CustZip,
                CustPhone             = title.CustPhone,
                CustPhone2            = title.CustPhone2,
                CustFName2            = title.CustFName2,
                CustLName2            = title.CustLName2,
                CustFName3            = title.CustFName3,
                CustLName3            = title.CustLName3,
                TitleRecievedFromType = (Interaction.TitleReceivedFromTypes)title.TitleRecievedFromType
            };

            vm.Interaction = inter;
            return(View(vm));
        }