public ActionResult List(int?id) { if (Session["ClientId"] != null) { if (!Roles.IsUserInRole("CenterManager")) { if (id != null) { ViewData.Model = AssetModels.GetAssets((int)Session["ClientId"], (int)id); } else { ViewData.Model = AssetModels.GetAssets((int)Session["ClientId"], null); } //ViewData.Model = CourseModels.GetBatchList((int)Session["ClientId"]); } else if (Session["BranchId"] != null) { ViewData.Model = AssetModels.GetAssets((int)Session["ClientId"], (int)Session["BranchId"]); } } else { if (Roles.IsUserInRole("SuperAdmin")) { return(RedirectToAction("List", "Client")); } } return(View()); }
public object Get(AssetModels request) { ApiUser hdUser = request.ApiUser; CheckAssets(hdUser); return(Models.AssetModels.GetAssetModels(hdUser.OrganizationId, hdUser.DepartmentId, request.make_id)); }
public async Task <IActionResult> Delete(int id, AssetModels modelcollection) { if (ModelState.IsValid) { await modelsRepository.DeleteAsync(modelcollection); return(RedirectToAction(nameof(Index))); } return(View()); }
public async Task <IActionResult> Create(AssetModels model) { if (ModelState.IsValid) { await modelsRepository.AddAsync(model); return(RedirectToAction(nameof(Index))); } return(View(model)); }
public async Task <IActionResult> Edit(int id, AssetModels collection) { if (ModelState.IsValid) { await modelsRepository.UpdateAsync(collection); return(RedirectToAction(nameof(Index))); } return(View(collection)); }
public ActionResult Create(FormCollection form, Assets asset, string chkIsWorking) { if (Session["ClientId"] != null) { if (!Roles.IsUserInRole("CenterManager")) { if (Session["RegionId"] != null) { ViewData["Branches"] = Utilities.GetBranchNameList((int)Session["ClientId"], (int)Session["RegionId"]); } else { ViewData["Branches"] = Utilities.GetBranchNameList((int)Session["ClientId"]); } } } try { if (Session["BranchId"] != null) { asset.BranchId = (int)Session["BranchId"]; } if (!ModelState.IsValid) { return(View()); } // TODO: Add insert logic here if ("on".Equals(chkIsWorking)) { asset.IsWorking = true; } else { asset.IsWorking = false; } if (AssetModels.CreateAsset(asset) > 0) { return(RedirectToAction("List")); } else { return(View()); } } catch { return(View()); } }
public ActionResult Edit(int id) { if (Session["ClientId"] != null) { if (!Roles.IsUserInRole("CenterManager")) { if (Session["RegionId"] != null) { ViewData["Branches"] = Utilities.GetBranchNameList((int)Session["ClientId"], (int)Session["RegionId"]); } else { ViewData["Branches"] = Utilities.GetBranchNameList((int)Session["ClientId"]); } } } ViewData.Model = AssetModels.GetAssetDetailsById(id); return(View()); }
public async Task UpdateAssetModelAsync(AssetModelViewModel assetModelViewModel, string userId) { _logger.LogInformation("UpdateAssetModelAsync called."); var model = new AssetModels() { Id = assetModelViewModel.Id, Name = assetModelViewModel.Name, ManufacturerId = assetModelViewModel.ManufacturerId, CategoryId = assetModelViewModel.CategoryId, ModelNumber = assetModelViewModel.ModelNumber, DepreciationId = assetModelViewModel.DepreciationId, Eol = assetModelViewModel.Eol, Image = assetModelViewModel.Image, DeprecatedMacAdress = assetModelViewModel.DeprecatedMacAdress, Notes = assetModelViewModel.Notes, Requestable = assetModelViewModel.Requestable, UpdatedAt = DateTime.Now, UpdatedBy = userId }; await _asyncRepository.UpdateAsync(model); }
public ActionResult Details(int id) { ViewData.Model = AssetModels.GetAssetDetailsById(id); return(View()); }