public IActionResult EditBranch(int id) { var branch = _branch.GetById(id); var editbranchViewModel = new EditBranchViewModel { Id = branch.Id, Name = branch.Name, Address = branch.Address, Telephone = branch.Telephone, Description = branch.Description, OpenDate = branch.OpenDate, ExistingImageName = branch.ImageUrl }; return(View(editbranchViewModel)); }
public IActionResult Detail(int id) { var branchDetail = _ILibraryBranches.GetById(id); var model = new BranchDetailModel() { Id = id, Name = branchDetail.Name, Address = branchDetail.Address, Telephone = branchDetail.Telephone, ImageUrl = branchDetail.ImageURL, Description = branchDetail.Description, OpeningClosingHours = branchDetail.OpenDate }; return(View(model)); }
public IActionResult Detail(int id) { Models.LibraryBranch branch = _branch.GetById(id);//.LibraryBranches.ToList(); if (branch == null) { return(RedirectToAction("Index")); } BranchDetailModel model = new BranchDetailModel(branch) { NumberOfAssets = _branch.GetAssets(branch.Id).Count(), NumberOfPatrons = _branch.GetPatrons(branch.Id).Count(), TotalAssetValue = _branch.GetAssets(branch.Id).Sum(c => c.Cost), HoursOpen = _branch.GetBranchHours(branch.Id), }; return(View(model)); }
public IActionResult Detail(int id) { var b = _branch.GetById(id); var model = new BranchDetailModel() { Id = b.Id, Name = b.Name, Address = b.Address, Telephone = b.Telephone, OpenDate = b.OpenDate.ToString("dd-MM-yyyy"), NumberOfAssets = _branch.GetAssets(b.Id).Count(), NuberOFPatons = _branch.GetPatrons(b.Id).Count(), TotalAssetValue = _branch.GetAssets(id).Sum(a => a.Cost), ImageUrl = b.ImageUrl, HoursOpen = _branch.GetBranchHours(id) }; return(View(model)); }
public IActionResult Detail(int Id) { var p = _branch.GetById(Id); var model = new BranchDetailModel { Id = p.Id, Name = p.Name, Address = p.Address, Telephone = p.Telephone, Description = p.Description, OpenDate = p.OpenDate.ToString("yyyyy'-'MM"), NumberOfUser = _branch.GetAllUsers(Id).Count(), TotalLibraryAssetCount = _branch.GetAllAssets(Id).Count(), ImageUrl = "", IsOpen = _branch.IsOpen(Id), TotalLibraryAssetValue = _branch.GetAllAssets(Id).Sum(a => a.Cost), HoursOpen = _branch.GetHours(Id) }; return(View(model)); }