Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,Name")] Contractor contractor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(contractor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(contractor));
        }
Beispiel #2
0
        public async Task <string> PostAsync([FromBody] CameraInfo cameraInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cameraInfo);
                await _context.SaveChangesAsync();

                return("ok");
            }
            return("error");
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Id,Lat,Lng,Img,Rating")] CameraInfo cameraInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(cameraInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cameraInfo));
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("Id,Type,DeviceId")] Sign sign)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sign);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(sign));
        }
Beispiel #5
0
        public async Task <IActionResult> Create([Bind("Id,Name,ContractorId")] Work work)
        {
            if (ModelState.IsValid)
            {
                _context.Add(work);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ContractorId"] = new SelectList(_context.Contractors, "Id", "Name", work.ContractorId);
            return(View(work));
        }
Beispiel #6
0
        public async Task <string> PostAsync([FromQuery] SignInfo signInfo)
        {
            if (ModelState.IsValid)
            {
                var signId = signInfo.SignId;
                var sign   = await _context.Sign.FirstOrDefaultAsync(i => i.Id == signId);

                var workId = sign.WorkId;
                signInfo.WorkId  = workId;
                signInfo.Created = DateTime.Now;
                sign.Lat         = signInfo.Lat;
                sign.Lng         = signInfo.Lng;

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

                return("ok");
            }
            return("error");
        }