Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,DictCinematographyServicesId,ListOfCinematographyId,DictStatusId,DeactivateStatus,CreateDate,ApplicationUserId")] ListOfCinematographyServices listOfCinematographyServices)
        {
            if (id != listOfCinematographyServices.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    string uid = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
                    listOfCinematographyServices.ApplicationUserId = uid;
                    _context.Update(listOfCinematographyServices);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ListOfCinematographyServicesExists(listOfCinematographyServices.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DictCinematographyServicesId"] = new SelectList(_context.DictCinematographyServices, "Id", "NameRus", listOfCinematographyServices.DictCinematographyServicesId);
            ViewData["DictStatusId"]           = new SelectList(_context.DictStatus, "Id", "Name", listOfCinematographyServices.DictStatusId);
            ViewData["ListOfCinematographyId"] = new SelectList(_context.ListOfCinematography, "Id", "NameRus", listOfCinematographyServices.ListOfCinematographyId);
            return(View(listOfCinematographyServices));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Create([Bind("Id,DictCinematographyServicesId,ListOfCinematographyId,DictStatusId,DeactivateStatus,CreateDate,ApplicationUserId")] ListOfCinematographyServices listOfCinematographyServices)
        {
            if (ModelState.IsValid)
            {
                _context.Add(listOfCinematographyServices);
                await _context.SaveChangesAsync();

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

            ViewData["DictCinematographyServicesId"] = new SelectList(_context.DictCinematographyServices, "Id", "NameRus", listOfCinematographyServices.DictCinematographyServicesId);
            ViewData["DictStatusId"]           = new SelectList(_context.DictStatus, "Id", "Name", listOfCinematographyServices.DictStatusId);
            ViewData["ListOfCinematographyId"] = new SelectList(_context.ListOfCinematography, "Id", "NameRus", listOfCinematographyServices.ListOfCinematographyId);

            return(View(listOfCinematographyServices));
        }
Exemplo n.º 3
0
        public IActionResult Create()
        {
            ViewData["DictCinematographyServicesId"] = new SelectList(_context.DictCinematographyServices, "Id", "NameRus");
            ViewData["DictStatusId"]           = new SelectList(_context.DictStatus, "Id", "Name");
            ViewData["ListOfCinematographyId"] = new SelectList(_context.ListOfCinematography, "Id", "NameRus");

            string name = "0";

            if (HttpContext.Request.Cookies.ContainsKey("ListOfCinemotograpy"))
            {
                name = HttpContext.Request.Cookies["ListOfCinemotograpy"];
            }

            string uid = _httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;

            ListOfCinematographyServices model = new ListOfCinematographyServices();

            model.ListOfCinematographyId = int.Parse(name);
            model.CreateDate             = DateTime.Now;
            model.ApplicationUserId      = uid;

            return(View(model));
        }