public MetaTabControlViewModel(IContainerExtension container, IRegionManager regionManager) { _regionManager = regionManager; _modelMaster = container.Resolve <ModelMaster>(); _modelMaster.ObserveProperty(x => x.ImageMetas).Where(x => x != null).Subscribe(x => AddTab(x)); }
public async Task <IHttpActionResult> PutModelMaster(int id, ModelMaster modelMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != modelMaster.Id) { return(BadRequest()); } db.Entry(modelMaster).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ModelMasterExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public MainWindowViewModel(IContainerExtension container, IRegionManager regionManager) { _regionManager = regionManager; _modelMaster = container.Resolve <ModelMaster>(); AddTab1Command = new DelegateCommand(AddTab1); AddTab2Command = new DelegateCommand(AddTab2); ClearAllMarksCommand = new DelegateCommand(ClearAllMarks); }
public async Task <IHttpActionResult> GetModelMaster(int id) { ModelMaster modelMaster = await db.ModelMasters.FindAsync(id); if (modelMaster == null) { return(NotFound()); } return(Ok(modelMaster)); }
public async Task <IHttpActionResult> PostModelMaster(ModelMaster modelMaster) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ModelMasters.Add(modelMaster); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = modelMaster.Id }, modelMaster)); }
public async Task <IHttpActionResult> DeleteModelMaster(int id) { ModelMaster modelMaster = await db.ModelMasters.FindAsync(id); if (modelMaster == null) { return(NotFound()); } db.ModelMasters.Remove(modelMaster); await db.SaveChangesAsync(); return(Ok(modelMaster)); }
public async Task <ActionResult> Create(ModelsListModel model, bool continueEditing) { try { var modelInfo = new ModelMaster { ModelCode = model.ModelCode, ModelName = model.ModelName, FriendlyName = model.FriendlyName, Active = model.Active, Deleted = false, DateUpdated = DateTime.UtcNow, DateCreated = DateTime.UtcNow, ByUser = Convert.ToInt32(HttpContext.User.FindFirst(claim => claim.Type == System.Security.Claims.ClaimTypes.NameIdentifier)?.Value) }; await _modelMasterService.InsertAsync(modelInfo); //add model varient mapping foreach (var varMap in model.SelectedVarientIds) { await _modelMasterService.AddVarientMappingAsync(new ModelVarientMapping { ModelId = modelInfo.Id, VarientId = varMap }); } if (continueEditing) { return(RedirectToAction(nameof(Edit), new { id = modelInfo.Id })); } TempData["UserMessageSuccess"] = "Record saved sucessfully."; return(RedirectToAction(nameof(List))); } catch (Exception ex) { TempData["UserMessageError"] = ex.Message.ToString(); return(RedirectToAction(nameof(Create))); } }
public async Task DeleteAsync(ModelMaster entity) { await _modelMasterRepo.RemoveAsync(entity); }
public async Task UpdateAsync(ModelMaster entity) { await _modelMasterRepo.UpdateAsync(entity); }
public async Task InsertAsync(ModelMaster entity) { await _modelMasterRepo.AddAsync(entity); }