// GET: User public ActionResult Index() { using (OurContext db = new OurContext()) { return(View(db.users.ToList())); } }
public ActionResult Register(UserAccount user) { if (ModelState.IsValid) { var isExist = IsEmailExist(user.Email); if (isExist) { ModelState.AddModelError("EmailExist", "Email already exist"); return(View(user)); } using (OurContext db = new OurContext()) { db.users.Add(user); db.SaveChanges(); } ModelState.Clear(); ViewBag.Message = user.Email + " successfully registered."; } else { ModelState.AddModelError("", "Some error occurred"); } return(View()); }
public override void ReloadReferences() { // Do not reload references if the current object has been deleted. // TODO: enable when MemoryContext uses MemoryDataObjects //if (this.ObjectState == DataObjectState.Deleted) return; base.ReloadReferences(); // fix direct object references if (_fk_Owner.HasValue) { this.Owner = ((Zetbox.App.Base.IdentityNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Identity>(_fk_Owner.Value)); } else { this.Owner = null; } if (_fk_guid_Type.HasValue) { this.Type = ((Zetbox.App.Base.ObjectClassNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.ObjectClass>(_fk_guid_Type.Value)); } else if (_fk_Type.HasValue) { this.Type = ((Zetbox.App.Base.ObjectClassNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.ObjectClass>(_fk_Type.Value)); } else { this.Type = null; } }
public override void ToStream(Zetbox.API.ZetboxStreamWriter binStream, HashSet <IStreamable> auxObjects, bool eagerLoadLists) { base.ToStream(binStream, auxObjects, eagerLoadLists); // it may be only an empty shell to stand-in for unreadable data if (!CurrentAccessRights.HasReadRights()) { return; } binStream.Write(this.Proxy.ControlKind != null ? OurContext.GetIdFromProxy(this.Proxy.ControlKind) : (int?)null); binStream.Write(this.Proxy.ControlRef != null ? OurContext.GetIdFromProxy(this.Proxy.ControlRef) : (int?)null); binStream.Write(this._isExportGuidSet); if (this._isExportGuidSet) { binStream.Write(this.Proxy.ExportGuid); } binStream.Write(this.Proxy.Module != null ? OurContext.GetIdFromProxy(this.Proxy.Module) : (int?)null); binStream.Write(eagerLoadLists); if (eagerLoadLists && auxObjects != null) { foreach (var obj in SupportedViewModels) { auxObjects.Add(obj); } foreach (var relEntry in this.Proxy.SupportedViewModels) { auxObjects.Add(OurContext.AttachAndWrap(relEntry)); } } binStream.Write((int?)Proxy.Toolkit); }
public override void ToStream(Zetbox.API.ZetboxStreamWriter binStream, HashSet <IStreamable> auxObjects, bool eagerLoadLists) { base.ToStream(binStream, auxObjects, eagerLoadLists); // it may be only an empty shell to stand-in for unreadable data if (!CurrentAccessRights.HasReadRights()) { return; } binStream.Write(this.Proxy.ChangedBy != null ? OurContext.GetIdFromProxy(this.Proxy.ChangedBy) : (int?)null); binStream.Write(this._isChangedOnSet); if (this._isChangedOnSet) { binStream.Write(this.Proxy.ChangedOn); } binStream.Write(this.Proxy.CreatedBy != null ? OurContext.GetIdFromProxy(this.Proxy.CreatedBy) : (int?)null); binStream.Write(this._isCreatedOnSet); if (this._isCreatedOnSet) { binStream.Write(this.Proxy.CreatedOn); } binStream.Write(this._isExportGuidSet); if (this._isExportGuidSet) { binStream.Write(this.Proxy.ExportGuid); } binStream.Write(this.Proxy.Property != null ? OurContext.GetIdFromProxy(this.Proxy.Property) : (int?)null); }
public override void ReloadReferences() { // Do not reload references if the current object has been deleted. // TODO: enable when MemoryContext uses MemoryDataObjects //if (this.ObjectState == DataObjectState.Deleted) return; base.ReloadReferences(); // fix direct object references if (_fk_Identity.HasValue) { this.Identity = ((Zetbox.App.Base.IdentityNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Identity>(_fk_Identity.Value)); } else { this.Identity = null; } if (_fk_Parent.HasValue) { this.Parent = ((Zetbox.App.Test.SecurityTestParentNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Test.SecurityTestParent>(_fk_Parent.Value)); } else { this.Parent = null; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "Blob": { var __oldValue = (Zetbox.App.Base.BlobNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.Blob); var __newValue = (Zetbox.App.Base.BlobNHibernateImpl)parentObj; NotifyPropertyChanging("Blob", __oldValue, __newValue); this.Proxy.Blob = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("Blob", __oldValue, __newValue); } break; case "Module": { var __oldValue = (Zetbox.App.Base.ModuleNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.Module); var __newValue = (Zetbox.App.Base.ModuleNHibernateImpl)parentObj; NotifyPropertyChanging("Module", __oldValue, __newValue); this.Proxy.Module = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("Module", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public override void ReloadReferences() { // Do not reload references if the current object has been deleted. // TODO: enable when MemoryContext uses MemoryDataObjects //if (this.ObjectState == DataObjectState.Deleted) return; base.ReloadReferences(); // fix direct object references if (_fk_DisplayedTypeAssembly.HasValue) { this.DisplayedTypeAssembly = ((Zetbox.App.Base.AssemblyNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Assembly>(_fk_DisplayedTypeAssembly.Value)); } else { this.DisplayedTypeAssembly = null; } if (_fk_VisualTree.HasValue) { this.VisualTree = ((Zetbox.App.GUI.VisualNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.GUI.Visual>(_fk_VisualTree.Value)); } else { this.VisualTree = null; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "Owner": { var __oldValue = (Zetbox.App.Base.IdentityNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.Owner); var __newValue = (Zetbox.App.Base.IdentityNHibernateImpl)parentObj; NotifyPropertyChanging("Owner", __oldValue, __newValue); this.Proxy.Owner = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("Owner", __oldValue, __newValue); } break; case "Type": { var __oldValue = (Zetbox.App.Base.ObjectClassNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.Type); var __newValue = (Zetbox.App.Base.ObjectClassNHibernateImpl)parentObj; NotifyPropertyChanging("Type", __oldValue, __newValue); this.Proxy.Type = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("Type", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "GetErrorTextInvocation": { var __oldValue = (Zetbox.App.Base.ConstraintInvocationNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.GetErrorTextInvocation); var __newValue = (Zetbox.App.Base.ConstraintInvocationNHibernateImpl)parentObj; NotifyPropertyChanging("GetErrorTextInvocation", __oldValue, __newValue); this.Proxy.GetErrorTextInvocation = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("GetErrorTextInvocation", __oldValue, __newValue); } break; case "IsValidInvocation": { var __oldValue = (Zetbox.App.Base.ConstraintInvocationNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.IsValidInvocation); var __newValue = (Zetbox.App.Base.ConstraintInvocationNHibernateImpl)parentObj; NotifyPropertyChanging("IsValidInvocation", __oldValue, __newValue); this.Proxy.IsValidInvocation = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("IsValidInvocation", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "DisplayedTypeAssembly": { var __oldValue = (Zetbox.App.Base.AssemblyNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.DisplayedTypeAssembly); var __newValue = (Zetbox.App.Base.AssemblyNHibernateImpl)parentObj; NotifyPropertyChanging("DisplayedTypeAssembly", __oldValue, __newValue); this.Proxy.DisplayedTypeAssembly = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("DisplayedTypeAssembly", __oldValue, __newValue); } break; case "VisualTree": { var __oldValue = (Zetbox.App.GUI.VisualNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.VisualTree); var __newValue = (Zetbox.App.GUI.VisualNHibernateImpl)parentObj; NotifyPropertyChanging("VisualTree", __oldValue, __newValue); this.Proxy.VisualTree = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("VisualTree", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "Identity": { var __oldValue = (Zetbox.App.Base.IdentityNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.Identity); var __newValue = (Zetbox.App.Base.IdentityNHibernateImpl)parentObj; NotifyPropertyChanging("Identity", __oldValue, __newValue); this.Proxy.Identity = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("Identity", __oldValue, __newValue); } break; case "Parent": { var __oldValue = (Zetbox.App.Test.SecurityTestParentNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.Parent); var __newValue = (Zetbox.App.Test.SecurityTestParentNHibernateImpl)parentObj; NotifyPropertyChanging("Parent", __oldValue, __newValue); this.Proxy.Parent = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("Parent", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "TestCustomObjects_Nav": { var __oldValue = (Zetbox.App.Test.TestCustomObjectNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.TestCustomObjects_Nav); var __newValue = (Zetbox.App.Test.TestCustomObjectNHibernateImpl)parentObj; NotifyPropertyChanging("TestCustomObjects_Nav", __oldValue, __newValue); this.Proxy.TestCustomObjects_Nav = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("TestCustomObjects_Nav", __oldValue, __newValue); } break; case "TestCustomObjects_One_Nav": { var __oldValue = (Zetbox.App.Test.TestCustomObjectNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.TestCustomObjects_One_Nav); var __newValue = (Zetbox.App.Test.TestCustomObjectNHibernateImpl)parentObj; NotifyPropertyChanging("TestCustomObjects_One_Nav", __oldValue, __newValue); this.Proxy.TestCustomObjects_One_Nav = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("TestCustomObjects_One_Nav", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public bool IsEmailExist(string email) { using (OurContext dc = new OurContext()) { var v = dc.users.Where(a => a.Email == email).FirstOrDefault(); return(v != null); } }
public override void ToStream(Zetbox.API.ZetboxStreamWriter binStream, HashSet <IStreamable> auxObjects, bool eagerLoadLists) { base.ToStream(binStream, auxObjects, eagerLoadLists); // it may be only an empty shell to stand-in for unreadable data if (!CurrentAccessRights.HasReadRights()) { return; } binStream.Write(this.Proxy.Enumeration != null ? OurContext.GetIdFromProxy(this.Proxy.Enumeration) : (int?)null); }
public override void ToStream(Zetbox.API.ZetboxStreamWriter binStream, HashSet <IStreamable> auxObjects, bool eagerLoadLists) { base.ToStream(binStream, auxObjects, eagerLoadLists); // it may be only an empty shell to stand-in for unreadable data if (!CurrentAccessRights.HasReadRights()) { return; } binStream.Write(this.Proxy.DisplayedTypeAssembly != null ? OurContext.GetIdFromProxy(this.Proxy.DisplayedTypeAssembly) : (int?)null); binStream.Write(this.Proxy.DisplayedTypeFullName); binStream.Write(this.Proxy.DisplayName); binStream.Write(this.Proxy.VisualTree != null ? OurContext.GetIdFromProxy(this.Proxy.VisualTree) : (int?)null); }
public override void ReloadReferences() { // Do not reload references if the current object has been deleted. // TODO: enable when MemoryContext uses MemoryDataObjects //if (this.ObjectState == DataObjectState.Deleted) return; base.ReloadReferences(); // fix direct object references if (_fk_guid_ControlKind.HasValue) { this.ControlKind = ((Zetbox.App.GUI.ControlKindNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.GUI.ControlKind>(_fk_guid_ControlKind.Value)); } else if (_fk_ControlKind.HasValue) { this.ControlKind = ((Zetbox.App.GUI.ControlKindNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.GUI.ControlKind>(_fk_ControlKind.Value)); } else { this.ControlKind = null; } if (_fk_guid_ControlRef.HasValue) { this.ControlRef = ((Zetbox.App.Base.TypeRefNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.TypeRef>(_fk_guid_ControlRef.Value)); } else if (_fk_ControlRef.HasValue) { this.ControlRef = ((Zetbox.App.Base.TypeRefNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.TypeRef>(_fk_ControlRef.Value)); } else { this.ControlRef = null; } if (_fk_guid_Module.HasValue) { this.Module = ((Zetbox.App.Base.ModuleNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Module>(_fk_guid_Module.Value)); } else if (_fk_Module.HasValue) { this.Module = ((Zetbox.App.Base.ModuleNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Module>(_fk_Module.Value)); } else { this.Module = null; } }
public override void ToStream(Zetbox.API.ZetboxStreamWriter binStream, HashSet <IStreamable> auxObjects, bool eagerLoadLists) { base.ToStream(binStream, auxObjects, eagerLoadLists); // it may be only an empty shell to stand-in for unreadable data if (!CurrentAccessRights.HasReadRights()) { return; } binStream.Write(this.Proxy.TestBool); binStream.Write(this.Proxy.TestCustomObjects_Nav != null ? OurContext.GetIdFromProxy(this.Proxy.TestCustomObjects_Nav) : (int?)null); binStream.Write(this.Proxy.TestCustomObjects_One_Nav != null ? OurContext.GetIdFromProxy(this.Proxy.TestCustomObjects_One_Nav) : (int?)null); binStream.Write(this.Proxy.TestDateTime); binStream.Write((int?)Proxy.TestEnum); binStream.Write(this.Proxy.TestString); }
public ActionResult Login(UserAccount user) { using (OurContext db = new OurContext()) { var usr = db.users.Where(u => u.Email == user.Email && u.Password == user.Password).FirstOrDefault(); if (usr != null) { Session["UserID"] = usr.UserID.ToString(); Session["Email"] = usr.Email.ToString(); return(RedirectToAction("LoggedIn", "Home")); } else { ModelState.AddModelError("", "Wrong email or password"); } } return(View()); }
public override void ReloadReferences() { // Do not reload references if the current object has been deleted. // TODO: enable when MemoryContext uses MemoryDataObjects //if (this.ObjectState == DataObjectState.Deleted) return; base.ReloadReferences(); // fix direct object references if (_fk_OneEnd.HasValue) { this.OneEnd = ((Zetbox.App.Test.OrderedOneEndNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Test.OrderedOneEnd>(_fk_OneEnd.Value)); } else { this.OneEnd = null; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "DefaultPropertyViewModelDescriptor": { var __oldValue = (Zetbox.App.GUI.ViewModelDescriptorNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.DefaultPropertyViewModelDescriptor); var __newValue = (Zetbox.App.GUI.ViewModelDescriptorNHibernateImpl)parentObj; NotifyPropertyChanging("DefaultPropertyViewModelDescriptor", __oldValue, __newValue); this.Proxy.DefaultPropertyViewModelDescriptor = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("DefaultPropertyViewModelDescriptor", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "CompoundObjectDefinition": { var __oldValue = (Zetbox.App.Base.CompoundObjectNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.CompoundObjectDefinition); var __newValue = (Zetbox.App.Base.CompoundObjectNHibernateImpl)parentObj; NotifyPropertyChanging("CompoundObjectDefinition", __oldValue, __newValue); this.Proxy.CompoundObjectDefinition = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("CompoundObjectDefinition", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public override void UpdateParent(string propertyName, IDataObject parentObj) { switch (propertyName) { case "ObjectProp": { var __oldValue = (Zetbox.App.Projekte.KundeNHibernateImpl)OurContext.AttachAndWrap(this.Proxy.ObjectProp); var __newValue = (Zetbox.App.Projekte.KundeNHibernateImpl)parentObj; NotifyPropertyChanging("ObjectProp", __oldValue, __newValue); this.Proxy.ObjectProp = __newValue == null ? null : __newValue.Proxy; NotifyPropertyChanged("ObjectProp", __oldValue, __newValue); } break; default: base.UpdateParent(propertyName, parentObj); break; } }
public override void ToStream(Zetbox.API.ZetboxStreamWriter binStream, HashSet <IStreamable> auxObjects, bool eagerLoadLists) { base.ToStream(binStream, auxObjects, eagerLoadLists); // it may be only an empty shell to stand-in for unreadable data if (!CurrentAccessRights.HasReadRights()) { return; } binStream.Write(eagerLoadLists); if (eagerLoadLists && auxObjects != null) { foreach (var obj in Inputs) { auxObjects.Add(obj); } foreach (var relEntry in this.Proxy.Inputs) { auxObjects.Add(OurContext.AttachAndWrap(relEntry)); } } binStream.Write(this.Proxy.ReferencedClass != null ? OurContext.GetIdFromProxy(this.Proxy.ReferencedClass) : (int?)null); }
public override void ReloadReferences() { // Do not reload references if the current object has been deleted. // TODO: enable when MemoryContext uses MemoryDataObjects //if (this.ObjectState == DataObjectState.Deleted) return; base.ReloadReferences(); // fix direct object references if (_fk_guid_Enumeration.HasValue) { this.Enumeration = ((Zetbox.App.Base.EnumerationNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Enumeration>(_fk_guid_Enumeration.Value)); } else if (_fk_Enumeration.HasValue) { this.Enumeration = ((Zetbox.App.Base.EnumerationNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.Base.Enumeration>(_fk_Enumeration.Value)); } else { this.Enumeration = null; } }
public BaseRepository() { ourContext = new OurContext(); }
public override void ReloadReferences() { // Do not reload references if the current object has been deleted. // TODO: enable when MemoryContext uses MemoryDataObjects //if (this.ObjectState == DataObjectState.Deleted) return; base.ReloadReferences(); // fix direct object references if (_fk_guid_DefaultPropertyViewModelDescriptor.HasValue) { this.DefaultPropertyViewModelDescriptor = ((Zetbox.App.GUI.ViewModelDescriptorNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.GUI.ViewModelDescriptor>(_fk_guid_DefaultPropertyViewModelDescriptor.Value)); } else if (_fk_DefaultPropertyViewModelDescriptor.HasValue) { this.DefaultPropertyViewModelDescriptor = ((Zetbox.App.GUI.ViewModelDescriptorNHibernateImpl)OurContext.FindPersistenceObject <Zetbox.App.GUI.ViewModelDescriptor>(_fk_DefaultPropertyViewModelDescriptor.Value)); } else { this.DefaultPropertyViewModelDescriptor = null; } }