Esempio n. 1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("DateOfIssuance,FileNumber,ValidatedBySessionNumber,TownName,District,Street,Basin,Part,ConstructionUse,ConstructionLicenseType,LicenseHolderInformation,LocalCommitteeNumber,DateApprovalLocalCommittee,LicenseDescription,LicenseConditions,FeeDate,RemainingFeesDate,BillOfFeesID,BillRemainingFeesID,ID,CreatedDate,UserID")] ConstructionLicense constructionLicense)
        {
            if (id != constructionLicense.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    constructionLicense.UpdatedDate = DateTime.UtcNow;

                    _context.Update(constructionLicense);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConstructionLicenseExists(constructionLicense.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(constructionLicense));
        }
Esempio n. 2
0
        // GET: ConstructionLicenses/Create
        public IActionResult Create()
        {
            ViewData["ConstructionLicenseType"] = new SelectList(from ConstructionLicenseType d in Enum.GetValues(typeof(ConstructionLicenseType)) select new { ID = (int)d, Name = Helper.Enumerations.GetEnumDescription(d) }, "ID", "Name");
            ViewData["BillOfFeesID"]            = new SelectList(_context.CatchReceipts, "ID", "FullName");
            ViewData["BillRemainingFeesID"]     = new SelectList(_context.CatchReceipts, "ID", "FullName");
            ViewData["UserID"] = new SelectList(_context.Users, "Id", "Id");
            var model = new ConstructionLicense();

            model.LicenseHolderInformation = new LicenseHolderInformation();
            return(View(model));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("DateOfIssuance,FileNumber,ValidatedBySessionNumber,TownName,District,Street,Basin,Part,ConstructionUse,ConstructionLicenseType,LicenseHolderInformation,LocalCommitteeNumber,DateApprovalLocalCommittee,LicenseDescription,LicenseConditions,FeeDate,RemainingFeesDate,BillOfFeesID,BillRemainingFeesID")] ConstructionLicense constructionLicense)
        {
            if (ModelState.IsValid)
            {
                var dateTime = DateTime.UtcNow;
                constructionLicense.ID          = Guid.NewGuid();
                constructionLicense.CreatedDate = dateTime;
                constructionLicense.UpdatedDate = dateTime;
                constructionLicense.UserID      = _userManager.GetUserId(User);
                constructionLicense.LicenseHolderInformation.ConstructionLicenseID = constructionLicense.ID;
                constructionLicense.LicenseHolderInformation.CreatedDate           = dateTime;
                constructionLicense.LicenseHolderInformation.UpdatedDate           = dateTime;
                constructionLicense.LicenseHolderInformation.UserID = _userManager.GetUserId(User);

                _context.Add(constructionLicense);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(constructionLicense));
        }