コード例 #1
0
        public async Task <IActionResult> Create([Bind("Id,Description,Created_at,Updated_at")] Block block)
        {
            if (ModelState.IsValid)
            {
                _context.Add(block);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(block));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Description,TypeEquipament,Status,Created_at,Updated_at")] Equipament equipament)
        {
            if (ModelState.IsValid)
            {
                _context.Add(equipament);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(equipament));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("Id,Name,UF,Created_at,Updated_at")] State state)
        {
            if (ModelState.IsValid)
            {
                _context.Add(state);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(state));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email,Username,Password,Created_at,Updated_at")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,NameResponsible,Email,Address,Phone,CityId,Created_at,Updated_at")] Client client)
        {
            if (ModelState.IsValid)
            {
                _context.Add(client);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", client.CityId);
            return(View(client));
        }
コード例 #6
0
        public async Task <IActionResult> Create([Bind("Id,Name,StateId,Created_at,Updated_at")] City city)
        {
            if (ModelState.IsValid)
            {
                _context.Add(city);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["StateId"] = new SelectList(_context.State, "Id", "Name", city.StateId);
            return(View(city));
        }
コード例 #7
0
        public async Task <IActionResult> Create([Bind("Id,ClientId,Description,UserId,Created_at,Updated_at")] Survey survey)
        {
            if (ModelState.IsValid)
            {
                _context.Add(survey);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ClientId"] = new SelectList(_context.Client, "Id", "Id", survey.ClientId);
            ViewData["UserId"]   = new SelectList(_context.User, "Id", "Email", survey.UserId);
            return(View(survey));
        }
コード例 #8
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email,Address,UserId,CityId,Created_at,Updated_at")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                _context.Add(employee);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CityId"] = new SelectList(_context.City, "Id", "Name", employee.CityId);
            ViewData["UserId"] = new SelectList(_context.User, "Id", "Email", employee.UserId);
            return(View(employee));
        }
コード例 #9
0
        public async Task <IActionResult> Create([Bind("Id,SurveyId,BlockId,FlooringId,EquipamentId")] SurveyResources surveyResources)
        {
            if (ModelState.IsValid)
            {
                _context.Add(surveyResources);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BlockId"]      = new SelectList(_context.Block, "Id", "Id", surveyResources.BlockId);
            ViewData["EquipamentId"] = new SelectList(_context.Equipament, "Id", "Id", surveyResources.EquipamentId);
            ViewData["FlooringId"]   = new SelectList(_context.Flooring, "Id", "Id", surveyResources.FlooringId);
            ViewData["SurveyId"]     = new SelectList(_context.Survey, "Id", "Id", surveyResources.SurveyId);
            return(View(surveyResources));
        }