public async Task <IActionResult> Edit(int id, [Bind("Id,NameRus,NameKyrg,DictTypeOfMonumentId,DateOfMonument,DictRegionId,DictDistrictId,Address")] ListOfMonument listOfMonument) { if (id != listOfMonument.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(listOfMonument); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ListOfMonumentExists(listOfMonument.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DictDistrictId"] = new SelectList(_context.DictDistrict, "Id", "NameRus", listOfMonument.DictDistrictId); ViewData["DictRegionId"] = new SelectList(_context.DictRegion, "Id", "NameRus", listOfMonument.DictRegionId); ViewData["DictTypeOfMonumentId"] = new SelectList(_context.DictTypeOfMonument, "Id", "NameRus", listOfMonument.DictTypeOfMonumentId); ViewData["DictAffiliationOfMonumentId"] = new SelectList(_context.DictAffiliationOfMonument, "Id", "NameRus"); return(View(listOfMonument)); }
ListOfMonument[] IGetLisencesSoap.GetListOfMonuments(int year) { try { var q = from l in db.ListOfMonuments join lf in db.DictMonumentType on l.DictMonumentTypeId equals lf.Id join d in db.DictDistrict on l.DictDistrictId equals d.Id //where mt.Id > 2 & l.EliminationDate == null //& gj.AnulmentDate==null & lcm.WarningEndDate!=null select new { Name = l.NameRus, DatingOfMonument = l.DatingOfMonument, District = d.NameRus, LegalAddress = l.LegalAddress, MonumentType = lf.NameRus }; ListOfMonument[] lst = new ListOfMonument[q.Count()]; int ind = 0; foreach (var item in q.ToList()) { lst[ind] = new ListOfMonument { DatingOfMonument = item.DatingOfMonument, District = item.District, LegalAddress = item.LegalAddress, MonumentType = item.MonumentType, Name = item.Name }; ind++; } return(lst); } catch (Exception) { return(null); } }
public async Task <IActionResult> Create([Bind("Id,NameRus,NameKyrg,DictTypeOfMonumentId,DateOfMonument,DictRegionId,DictDistrictId,Address")] ListOfMonument listOfMonument) { if (ModelState.IsValid) { _context.Add(listOfMonument); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DictDistrictId"] = new SelectList(_context.DictDistrict, "Id", "NameRus", listOfMonument.DictDistrictId); ViewData["DictRegionId"] = new SelectList(_context.DictRegion, "Id", "NameRus", listOfMonument.DictRegionId); ViewData["DictTypeOfMonumentId"] = new SelectList(_context.DictTypeOfMonument, "Id", "NameRus", listOfMonument.DictTypeOfMonumentId); ViewData["DictAffiliationOfMonumentId"] = new SelectList(_context.DictAffiliationOfMonument, "Id", "NameRus"); return(View(listOfMonument)); }