public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (createOrEdit.Id == null && !this.IsCodeUnique(createOrEdit.Code)) { this.ModelState.AddModelError("code", string.Empty); } if (this.ModelState.IsValid) { OrderState orderState = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(orderState); if (createOrEdit.Id == null) { this.Storage.GetRepository <IOrderStateRepository>().Create(orderState); } else { this.Storage.GetRepository <IOrderStateRepository>().Edit(orderState); } this.Storage.Save(); return(this.Redirect(this.Request.CombineUrl("/backend/orderstates"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Object @object = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IObjectRepository>().Create(@object); } else { this.Storage.GetRepository <IObjectRepository>().Edit(@object); } this.Storage.Save(); this.CreateOrEditProperties(@object); this.CreateOrEditRelations(@object); new SerializationManager(this).SerializeObject(@object); return(this.Redirect(this.Request.CombineUrl("/backend/objects"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (createOrEdit.Id == null && !this.IsCodeUnique(createOrEdit.DataTypeId, createOrEdit.Code)) { this.ModelState.AddModelError("code", string.Empty); } if (this.ModelState.IsValid) { DataTypeParameter dataTypeParameter = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IDataTypeParameterRepository>().Create(dataTypeParameter); } else { this.Storage.GetRepository <IDataTypeParameterRepository>().Edit(dataTypeParameter); } this.Storage.Save(); return(this.Redirect(this.Request.CombineUrl("/backend/datatypeparameters"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Field field = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(field); if (createOrEdit.Id == null) { this.Storage.GetRepository <IFieldRepository>().Create(field); } else { this.Storage.GetRepository <IFieldRepository>().Edit(field); } this.Storage.Save(); Event <IFormEditedEventHandler, IRequestHandler, Form, Form> .Broadcast(this, null, this.GetForm(field)); return(this.RedirectToAction("Index", "Forms")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Order order = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(order); if (createOrEdit.Id == null) { this.Storage.GetRepository <IOrderRepository>().Create(order); } else { this.Storage.GetRepository <IOrderRepository>().Edit(order); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IOrderCreatedEventHandler, IRequestHandler, Order> .Broadcast(this, order); } else { Event <IOrderEditedEventHandler, IRequestHandler, Order> .Broadcast(this, order); } return(this.Redirect(this.Request.CombineUrl("/backend/orders"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Attribute attribute = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(attribute); if (createOrEdit.Id == null) { this.Storage.GetRepository <IAttributeRepository>().Create(attribute); } else { this.Storage.GetRepository <IAttributeRepository>().Edit(attribute); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IAttributeCreatedEventHandler, IRequestHandler, Attribute> .Broadcast(this, attribute); } else { Event <IAttributeEditedEventHandler, IRequestHandler, Attribute> .Broadcast(this, attribute); } return(this.Redirect(this.Request.CombineUrl("/backend/attributes"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Menu menu = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(menu); if (createOrEdit.Id == null) { this.Storage.GetRepository <IMenuRepository>().Create(menu); } else { this.Storage.GetRepository <IMenuRepository>().Edit(menu); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IMenuCreatedEventHandler, IRequestHandler, Menu> .Broadcast(this, menu); } else { Event <IMenuEditedEventHandler, IRequestHandler, Menu> .Broadcast(this, menu); } return(this.RedirectToAction("Index")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Member member = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IMemberRepository>().Create(member); } else { this.Storage.GetRepository <IMemberRepository>().Edit(member); } this.Storage.Save(); this.CreateOrEditDataTypeParameterValues(member); if (createOrEdit.Id == null) { Event <IMemberCreatedEventHandler, IRequestHandler, Member> .Broadcast(this, member); } else { Event <IMemberEditedEventHandler, IRequestHandler, Member> .Broadcast(this, member); } return(this.Redirect(this.Request.CombineUrl("/backend/members"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Class @class = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IClassRepository>().Create(@class); } else { this.Storage.GetRepository <IClassRepository>().Edit(@class); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IClassCreatedEventHandler, IRequestHandler, Class> .Broadcast(this, @class); } else { Event <IClassEditedEventHandler, IRequestHandler, Class> .Broadcast(this, @class); } return(this.Redirect(this.Request.CombineUrl("/backend/classes"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Configuration configuration = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IConfigurationRepository>().Create(configuration); } else { this.Storage.GetRepository <IConfigurationRepository>().Edit(configuration); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IConfigurationCreatedEventHandler, IRequestHandler, Configuration> .Broadcast(this, configuration); } else { Event <IConfigurationEditedEventHandler, IRequestHandler, Configuration> .Broadcast(this, configuration); } return(this.RedirectToAction("Index")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Menu menu = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(menu); if (createOrEdit.Id == null) { this.Storage.GetRepository <IMenuRepository>().Create(menu); } else { this.Storage.GetRepository <IMenuRepository>().Edit(menu); } this.Storage.Save(); new SerializationManager(this).SerializeMenu(menu); return(this.RedirectToAction("Index")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Permission permission = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IPermissionRepository>().Create(permission); } else { this.Storage.GetRepository <IPermissionRepository>().Edit(permission); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IPermissionCreatedEventHandler, IRequestHandler, Permission> .Broadcast(this, permission); } else { Event <IPermissionEditedEventHandler, IRequestHandler, Permission> .Broadcast(this, permission); } return(this.Redirect(this.Request.CombineUrl("/backend/permissions"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Form form = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(form); if (createOrEdit.Id == null) { this.Storage.GetRepository <IFormRepository>().Create(form); } else { this.Storage.GetRepository <IFormRepository>().Edit(form); } this.Storage.Save(); new CacheManager(this).CacheForm(form); return(this.RedirectToAction("Index")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Variable variable = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IVariableRepository>().Create(variable); } else { this.Storage.GetRepository <IVariableRepository>().Edit(variable); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IVariableCreatedEventHandler, IRequestHandler, Variable> .Broadcast(this, variable); } else { Event <IVariableEditedEventHandler, IRequestHandler, Variable> .Broadcast(this, variable); } return(this.RedirectToAction("Index", "Configurations")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Object @object = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IObjectRepository>().Create(@object); } else { this.Storage.GetRepository <IObjectRepository>().Edit(@object); } this.Storage.Save(); this.CreateOrEditProperties(@object); this.CreateOrEditRelations(@object); if (createOrEdit.Id == null) { Event <IObjectCreatedEventHandler, IRequestHandler, Object> .Broadcast(this, @object); } else { Event <IObjectEditedEventHandler, IRequestHandler, Object> .Broadcast(this, @object); } return(this.Redirect(this.Request.CombineUrl("/backend/objects"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { DataType dataType = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IDataTypeRepository>().Create(dataType); } else { this.Storage.GetRepository <IDataTypeRepository>().Edit(dataType); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IDataTypeCreatedEventHandler, IRequestHandler, DataType> .Broadcast(this, dataType); } else { Event <IDataTypeEditedEventHandler, IRequestHandler, DataType> .Broadcast(this, dataType); } return(this.Redirect(this.Request.CombineUrl("/backend/datatypes"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { if (!string.IsNullOrEmpty(createOrEdit.Id)) { System.IO.File.Delete(PathManager.GetViewPath(this, createOrEdit.Subdirectory, createOrEdit.Id)); } System.IO.File.WriteAllText(PathManager.GetViewPath(this, createOrEdit.Subdirectory, createOrEdit.Filename), createOrEdit.Content); if (string.IsNullOrEmpty(createOrEdit.Id)) { Event <IViewCreatedEventHandler, IRequestHandler, string> .Broadcast(this, createOrEdit.Filename); } else { Event <IViewCreatedEventHandler, IRequestHandler, string> .Broadcast(this, createOrEdit.Filename); } return(this.RedirectToAction("Index", new { subdirectory = createOrEdit.Subdirectory })); } return(this.CreateRedirectToSelfResult()); }
public Platformus.Models.Configuration Map(CreateOrEditViewModel createOrEdit) { Platformus.Models.Configuration configuration = new Platformus.Models.Configuration(); if (createOrEdit.Id != null) configuration = this.handler.Storage.GetRepository<IConfigurationRepository>().WithKey((int)createOrEdit.Id); configuration.Code = createOrEdit.Code; configuration.Name = createOrEdit.Name; return configuration; }
public Class Map(CreateOrEditViewModel createOrEdit) { Class @class = new Class(); if (createOrEdit.Id != null) @class = this.handler.Storage.GetRepository<IClassRepository>().WithKey((int)createOrEdit.Id); @class.Name = createOrEdit.Name; @class.PluralizedName = createOrEdit.PluralizedName; @class.IsStandalone = createOrEdit.IsStandalone ? true : (bool?)null; @class.ViewName = createOrEdit.ViewName; return @class; }
public ActionResult CreateOrEdit(int?id) { var person = (id.HasValue) ? _context.People.SingleOrDefault(item => item.Id == id) : new Person(); var model = new CreateOrEditViewModel { Person = person, RelationTypes = _context.relationTypes.ToList() }; return(View(model)); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { if (!string.IsNullOrEmpty(createOrEdit.Id)) { System.IO.File.Delete(PathManager.GetStylePath(this, createOrEdit.Id)); } System.IO.File.WriteAllText(PathManager.GetStylePath(this, createOrEdit.Filename), createOrEdit.Content); BandleManager.RebuildAllBundles(this); return(this.RedirectToAction("Index")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Platformus.Models.Configuration configuration = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) this.Storage.GetRepository<IConfigurationRepository>().Create(configuration); else this.Storage.GetRepository<IConfigurationRepository>().Edit(configuration); this.Storage.Save(); return this.RedirectToAction("Index"); } return this.CreateRedirectToSelfResult(); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Class @class = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) this.Storage.GetRepository<IClassRepository>().Create(@class); else this.Storage.GetRepository<IClassRepository>().Edit(@class); this.Storage.Save(); return this.Redirect(this.Request.CombineUrl("/backend/classes")); } return this.CreateRedirectToSelfResult(); }
public ActionResult CreateOrEdit(CreateOrEditViewModel viewModel) { if (!ModelState.IsValid) { viewModel.RelationTypes = _context.relationTypes.ToList(); return(View("CreateOrEdit", viewModel)); } if (viewModel.Person.Id == 0) { _context.People.Add(viewModel.Person); } else { _context.Entry(viewModel.Person).State = System.Data.Entity.EntityState.Modified; } _context.SaveChanges(); return(RedirectToAction("Index", "People", new { @q = "succcess" })); }
public Object Map(CreateOrEditViewModel createOrEdit) { Object @object = new Object(); if (createOrEdit.Id != null) @object = this.handler.Storage.GetRepository<IObjectRepository>().WithKey((int)createOrEdit.Id); else @object.ClassId = (int)createOrEdit.ClassId; Class @class = this.handler.Storage.GetRepository<IClassRepository>().WithKey(@object.ClassId); if (@class.IsStandalone == true) @object.Url = createOrEdit._Url; else @object.Url = null; return @object; }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (createOrEdit.Id == null && !this.IsCodeUnique(createOrEdit.Code)) { this.ModelState.AddModelError("code", string.Empty); } if (this.ModelState.IsValid) { Product product = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(product); if (createOrEdit.Id == null) { this.Storage.GetRepository <IProductRepository>().Create(product); } else { this.Storage.GetRepository <IProductRepository>().Edit(product); } this.Storage.Save(); this.CreateOrEditAttributes(product, createOrEdit.RemovedAttributeIds); this.CreateOrEditPhotos(product, createOrEdit.RemovedPhotoIds); if (createOrEdit.Id == null) { Event <IProductCreatedEventHandler, IRequestHandler, Product> .Broadcast(this, product); } else { Event <IProductEditedEventHandler, IRequestHandler, Product> .Broadcast(this, product); } return(this.Redirect(this.Request.CombineUrl("/backend/products"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Object @object = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) this.Storage.GetRepository<IObjectRepository>().Create(@object); else this.Storage.GetRepository<IObjectRepository>().Edit(@object); this.Storage.Save(); this.CreateOrEditProperties(@object); this.CreateOrEditRelations(@object); new CacheManager(this).CacheObject(@object); return this.Redirect(this.Request.CombineUrl("/backend/objects")); } return this.CreateRedirectToSelfResult(); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (createOrEdit.Id == null && !this.IsCodeUnique(createOrEdit.Code)) { this.ModelState.AddModelError("code", string.Empty); } if (this.ModelState.IsValid) { Form form = new CreateOrEditViewModelMapper(this).Map(createOrEdit); this.CreateOrEditEntityLocalizations(form); if (createOrEdit.Id == null) { this.Storage.GetRepository <IFormRepository>().Create(form); } else { this.Storage.GetRepository <IFormRepository>().Edit(form); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IFormCreatedEventHandler, IRequestHandler, Form> .Broadcast(this, form); } else { Event <IFormEditedEventHandler, IRequestHandler, Form> .Broadcast(this, form); } return(this.RedirectToAction("Index")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (createOrEdit.Id == null && !this.IsCodeUnique(createOrEdit.EndpointId, createOrEdit.Code)) { this.ModelState.AddModelError("code", string.Empty); } if (this.ModelState.IsValid) { DataSource dataSource = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IDataSourceRepository>().Create(dataSource); } else { this.Storage.GetRepository <IDataSourceRepository>().Edit(dataSource); } this.Storage.Save(); if (createOrEdit.Id == null) { Event <IDataSourceCreatedEventHandler, IRequestHandler, DataSource> .Broadcast(this, dataSource); } else { Event <IDataSourceEditedEventHandler, IRequestHandler, DataSource, DataSource> .Broadcast( this, this.Storage.GetRepository <IDataSourceRepository>().WithKey((int)createOrEdit.Id), dataSource ); } return(this.Redirect(this.Request.CombineUrl("/backend/datasources"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (createOrEdit.Id == null && !this.IsCodeUnique(createOrEdit.Code)) { this.ModelState.AddModelError("code", string.Empty); } if (this.ModelState.IsValid) { Role role = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IRoleRepository>().Create(role); } else { this.Storage.GetRepository <IRoleRepository>().Edit(role); } this.Storage.Save(); this.CreateOrEditRolePermissions(role); if (createOrEdit.Id == null) { Event <IRoleCreatedEventHandler, IRequestHandler, Role> .Broadcast(this, role); } else { Event <IRoleEditedEventHandler, IRequestHandler, Role> .Broadcast(this, role); } return(this.Redirect(this.Request.CombineUrl("/backend/roles"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { DataSource dataSource = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IDataSourceRepository>().Create(dataSource); } else { this.Storage.GetRepository <IDataSourceRepository>().Edit(dataSource); } this.Storage.Save(); return(this.Redirect(this.Request.CombineUrl("/backend/datasources"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Microcontroller microcontroller = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IMicrocontrollerRepository>().Create(microcontroller); } else { this.Storage.GetRepository <IMicrocontrollerRepository>().Edit(microcontroller); } this.Storage.Save(); return(this.Redirect(this.Request.CombineUrl("/backend/microcontrollers"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Section section = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <ISectionRepository>().Create(section); } else { this.Storage.GetRepository <ISectionRepository>().Edit(section); } this.Storage.Save(); return(this.RedirectToAction("Index")); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Role role = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IRoleRepository>().Create(role); } else { this.Storage.GetRepository <IRoleRepository>().Edit(role); } this.Storage.Save(); this.CreateOrEditRolePermissions(role); return(this.Redirect(this.Request.CombineUrl("/backend/roles"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Culture culture = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <ICultureRepository>().Create(culture); } else { this.Storage.GetRepository <ICultureRepository>().Edit(culture); } this.Storage.Save(); CultureManager.InvalidateCache(); return(this.Redirect(this.Request.CombineUrl("/backend/cultures"))); } return(this.CreateRedirectToSelfResult()); }
public IActionResult CreateOrEdit(CreateOrEditViewModel createOrEdit) { if (this.ModelState.IsValid) { Variable variable = new CreateOrEditViewModelMapper(this).Map(createOrEdit); if (createOrEdit.Id == null) { this.Storage.GetRepository <IVariableRepository>().Create(variable); } else { this.Storage.GetRepository <IVariableRepository>().Edit(variable); } this.Storage.Save(); ConfigurationManager.InvalidateCache(); return(this.RedirectToAction("Index", "Configurations")); } return(this.CreateRedirectToSelfResult()); }