Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("ShareName,FiledID,ShareArea,ShareRealArea,ShareCN,ComplicationID")] Share share)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(share);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                ViewData["ComplicationID"] = new SelectList(_context.Complications, "ComplicationID", "ComplicationName", share.ComplicationID);
                PopulateFieldDropDownList(share.FiledID);
                return(View(share));
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            PopulateFieldDropDownList(share.FiledID);
            ViewData["ComplicationID"] = new SelectList(_context.Complications, "ComplicationID", "ComplicationName", share.ComplicationID);
            return(View(share));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("ShareID,LLID,ContractBegin,ContractEnd")] Contract contract)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(contract);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                ViewData["LLID"]    = new SelectList(_context.LandLords, "LandLordID", "LLName", contract.LLID);
                ViewData["ShareID"] = new SelectList(_context.Shares, "ShareID", "ShareName", contract.ShareID);
                return(View(contract));
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            ViewData["LLID"]    = new SelectList(_context.LandLords, "LandLordID", "LLName", contract.LLID);
            ViewData["ShareID"] = new SelectList(_context.Shares, "ShareID", "ShareName", contract.ShareID);
            return(View(contract));
        }
        public async Task <IActionResult> Create([Bind("ComplicationID,ComplicationName,ComplicationInfo")] Complication complication)
        {
            if (ModelState.IsValid)
            {
                _context.Add(complication);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(complication));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("FieldName,VCID")] Field @field)
        {
            if (ModelState.IsValid)
            {
                _context.Add(@field);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            PopulateVCDropDownList(@field.VCID);
            return(View(@field));
        }
        public async Task <IActionResult> Create([Bind("VCName")] VillageCouncil villageCouncil)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    _context.Add(villageCouncil);
                    await _context.SaveChangesAsync();

                    return(RedirectToAction(nameof(Index)));
                }
                return(View(villageCouncil));
            }
            catch (DbUpdateException /* ex */)
            {
                //Log the error (uncomment ex variable name and write a log.
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists " +
                                         "see your system administrator.");
            }
            return(View(villageCouncil));
        }