public ActionResult Create() { var locations = locationManager.GetAll().ToList(); DepartmentViewModel department = new DepartmentViewModel { Locations = locations }; return(View(department)); }
public ActionResult Create() { var department = departmentManager.GetAll().ToList(); var location = locationManager.GetAll().ToList(); UnitViewModel unit = new UnitViewModel { Departments = department, Locations = location }; return(View(unit)); }
public ActionResult Create() { var location = _locationManager.GetAll().ToList(); var unit = _unitManager.GetAll().ToList(); var host = _hostManager.GetAll().ToList(); InventoryViewModel inventory = new InventoryViewModel { Locations = location, Units = unit, Hosts = host }; return(View(inventory)); }
private void ExecuteGetLocations() { StartProgress(); LocationsFilter = string.Empty; _locations.Clear(); var locationGetTask = Task.Run(() => _locationManager.GetAll()); locationGetTask.ContinueWith(task => FinishProgress()); locationGetTask.ContinueWith(task => { if (task.IsFaulted || task.IsCanceled) { return; } foreach (var location in task.Result) { _locations.Add(location); } }); locationGetTask.ContinueWith(DispatchError); }
// GET: Location //[Authorize] //[AuthorizeUserAccessLevel(UserRole = "Admin")] public ActionResult Index() { try { var locations = _locationmanager.GetAll(); var llvm = new LocationListViewModel { Locations = locations }; //ViewData["Username"] = User.Identity.Name; return(View(llvm)); } catch (Exception ex) { //Log exception return(View(ex.Message, "Error")); } }
public ActionResult Create(Location location) { if (ModelState.IsValid && location != null) { ModelState.Clear(); try { var locationList = _locationManager.GetAll(c => true); int locationExist = locationList .Where(c => c.OrganizationId == location.OrganizationId) .Where(c => c.BranchId == location.BranchId) .Where(c => c.ShortName == location.ShortName) .Count(); if (locationExist > 0) { location.ShortName = null; ModelState.AddModelError("ShortName", "Short name for the location already exists"); } else { if (_locationManager.Add(location)) { ViewBag.Msg = "location added successfully!"; return(View()); } } } catch (Exception exception) { Console.WriteLine(exception.Message); } } return(View(location)); }