예제 #1
0
        public async Task <IActionResult> Save_filescmr(int Cmr_id, string Switch_shape)
        {
            try
            {
                //сохраняем атрибуты файлов, полученные в методе Upload, в таблицу files_cmr
                foreach (var file_cmr in filesCmrs)
                {
                    file_cmr.CmrId = Cmr_id;
                    _db.FilesCmrs.Add(file_cmr);
                    await _db.SaveChangesAsync();
                }
            }
            catch (Exception ex)
            {
                _logger.LogFatal(ex, "Error while saving files' attributes in files_cmr");
            }

            _logger.LogInfo("Files' attributes were saved in files_cmr");
            //перенапрявляем пользователя на страницу успешного добавления рамки
            switch (Switch_shape)
            {
            case "WKT":
                return(RedirectToAction("Ramka_Added_WKT", "Ramka", new { cmr_Id = Cmr_id }));

            case "SHP":
                return(RedirectToAction("Ramka_Added_SHP", "Ramka", new { cmr_Id = Cmr_id }));

            case "Draw":
                return(RedirectToAction("Ramka_Added_Draw", "Ramka", new { cmr_Id = Cmr_id }));

            default:
                _logger.LogInfo("Error in saving shape");
                return(Content("Error in saving shape"));
            }
        }
예제 #2
0
        //Save_Package_atrributes to the database
        //return ID of package
        public async Task <long> Save_Package_atrributes(DemandArchiveErs DAE)
        {
            _db.DemandArchiveErss.Add(DAE);
            await _db.SaveChangesAsync();

            return(DAE.DemandArchiveErsNr);
        }