Ejemplo n.º 1
0
 public ActionResult EditProfile(MyDetailModel model)
 {
     ViewBag.ok = "no";
     if (ModelState.IsValid)
     {
         try
         {
             UserDetail ud = UserDetailRepository.GetUserDetailById(model.UserDetailID);
             if (ud != null)
             {
                 Address ar = AddressRepository.AddAddress(ud.AddressId, model.AddressLine, "", model.City, model.State, model.ZipCode,
                                                           model.CrossStreet, ud.Address.AddedDate, ud.Address.AddedBy, DateTime.Now, UserName, true);
                 ContactInfo ci = ContactInfoRepository.AddContactInfo(ud.ContactInfoId, model.Phone, "", model.Email, ud.ContactInfo.AddedDate, ud.ContactInfo.AddedBy, DateTime.Now, UserName, true);
                 ud = UserDetailRepository.InsertUserDetail(ud.UserDetailId, ud.UserId, model.FirstName, model.LastName, ud.AddressId,
                                                            ud.ContactInfoId, ud.AddedDate, ud.AddedBy, DateTime.Now, UserName, true, CryptionClass.Encrypt("no password"));
                 ViewBag.ok = "yes";
                 return(PartialView(model));
             }
         }
         catch
         {
             ViewBag.ok = "no";
         }
     }
     return(PartialView(model));
 }
Ejemplo n.º 2
0
    public DetailViewModel(MyDetailModel detailModel)
    {
        // Retain the Detail Model
        this.model = detailModel;

        // Handle changes to the Model not coming from this ViewModel
        this.model.PropertyChanged += model_PropertyChanged;      // Potential leak?
    }
Ejemplo n.º 3
0
    public DetailViewModel(MyDetailModel model)
    {
        _model = model;
        _model.PropertyChanged += _model_PropertyChanged;
        Action removeHandler = () =>
                               _model.PropertyChanged -= _model_PropertyChanged;

        _disposables.Add(removeHandler);
    }
 public DetailViewModel(MyDetailModel detailModel)
 {
     // Retain the Detail Model
     this.model = detailModel;
     // Handle changes to the Model not coming from this ViewModel
     if (model != null)
     {
         PropertyChangedEventManager.AddHandler(model, model_PropertyChanged, "");
     }
 }
Ejemplo n.º 5
0
 public ActionResult AddMyDetail(MyDetailModel model)
 {
     ViewBag.ok = "no";
     if (ModelState.IsValid)
     {
         try
         {
             Address ar = AddressRepository.AddAddress(0, model.AddressLine, "", model.City, model.State, model.ZipCode,
                                                       model.CrossStreet, DateTime.Now, UserName, DateTime.Now, UserName, true);
             ContactInfo ci = ContactInfoRepository.AddContactInfo(0, model.Phone, "", model.Email, DateTime.Now, UserName, DateTime.Now, UserName, true);
             UserDetail  ud = UserDetailRepository.InsertUserDetail(0, model.UserID, model.FirstName, model.LastName, ar.AddressId,
                                                                    ci.ContactInfoId, DateTime.Now, UserName, DateTime.Now, UserName, true, CryptionClass.Encrypt("no password"));
             ViewBag.ok = "yes";
             return(PartialView(model));
         }
         catch
         {
             ViewBag.ok = "no";
         }
     }
     return(PartialView(model));
 }