public async Task <ActionResult> DeleteConfirmed(long id)
        {
            accident accident = await db.accidents.FindAsync(id);

            db.accidents.Remove(accident);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
        public async Task <ActionResult> Edit([Bind(Include = "id,Deaths,Injury,Lat,Long,Postcode,status")] accident accident)
        {
            if (ModelState.IsValid)
            {
                db.Entry(accident).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(accident));
        }
Exemplo n.º 3
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        private void init()
        {
            m_accident           = accident.none;
            m_is_interest        = false;
            m_sea_area_type_list = new List <sea_area_type>();

            // 분석대상を설정する
            init_analyze_list();

            ResetAll();
        }
        public async Task <ActionResult> Create([Bind(Include = "id,Deaths,Injury,Lat,Long,Postcode,status")] accident accident)
        {
            if (ModelState.IsValid)
            {
                db.accidents.Add(accident);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(accident));
        }
Exemplo n.º 5
0
        /*-------------------------------------------------------------------------
         *
         * ---------------------------------------------------------------------------*/
        public gvo_chat(string path, sea_area _sea_area)
        {
            m_path     = path;
            m_sea_area = _sea_area;

            m_newest_chat_file_info = null;                     // 更新が最も新しいログ
            m_chat_file_info        = null;                     // 解析対象のログ
            m_analyze_lines         = 0;                        // 解析状況

            m_accident           = accident.none;
            m_is_interest        = false;
            m_sea_area_type_list = new List <sea_area_type>();
        }
        // GET: accidents/Delete/5
        public async Task <ActionResult> Delete(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            accident accident = await db.accidents.FindAsync(id);

            if (accident == null)
            {
                return(HttpNotFound());
            }
            return(View(accident));
        }
Exemplo n.º 7
0
        /*-------------------------------------------------------------------------
         * 재해정보から保存용の値に변환する
         * ---------------------------------------------------------------------------*/
        static public int ToIndex(accident a)
        {
            switch (a)
            {
            case accident.shark1:                                       // 상어1
            case accident.shark2:                                       // 상어2
                return(101);

            case accident.fire:                                                 // 화재
                return(102);

            case accident.seaweed:                                      // 수초
                return(103);

            case accident.seiren:                                       // 사이렌
                return(104);

            case accident.compass:                                      // 나침반
                return(105);

            case accident.storm:                                        // 폭풍
                return(106);

            case accident.blizzard:                                     // 눈보라
                return(107);

            case accident.mouse:                                        // 쥐
                return(108);

            case accident.UMA:                                                  // 정체모를괴물
                return(109);

            case accident.treasure1:                                    // 何かいい物
            case accident.treasure2:                                    // 何か見つかるかも
            case accident.treasure3:                                    // 高価なもの
                return(111);

            case accident.escape_battle:                        // 全배が戦場を離れました
            case accident.win_battle:                           // 승리
            case accident.lose_battle:                          // 패배
                return(110);
            }
            return(-1);                         // unknown
        }
Exemplo n.º 8
0
        /*-------------------------------------------------------------------------
         * 災害情報から保存用の値に変換する
         * ---------------------------------------------------------------------------*/
        static public int ToIndex(accident a)
        {
            switch (a)
            {
            case accident.shark1:                                       // サメ1
            case accident.shark2:                                       // サメ2
                return(101);

            case accident.fire:                                                 // 火災
                return(102);

            case accident.seaweed:                                      // 藻
                return(103);

            case accident.seiren:                                       // セイレーン
                return(104);

            case accident.compass:                                      // 羅針盤
                return(105);

            case accident.storm:                                        // 嵐
                return(106);

            case accident.blizzard:                                     // 吹雪
                return(107);

            case accident.mouse:                                        // ネズミ
                return(108);

            case accident.UMA:                                                  // 得体の知れない怪物
                return(109);

            case accident.treasure1:                                    // 何かいい物
            case accident.treasure2:                                    // 何か見つかるかも
            case accident.treasure3:                                    // 高価なもの
                return(111);

            case accident.escape_battle:                        // 全船が戦場を離れました
            case accident.win_battle:                           // 勝利
            case accident.lose_battle:                          // 敗北
                return(110);
            }
            return(-1);                         // unknown
        }
Exemplo n.º 9
0
        /*-------------------------------------------------------------------------
         * アクシデントの변환
         * ---------------------------------------------------------------------------*/
        static public string ToAccidentString(accident __accident)
        {
            switch (__accident)
            {
            case accident.shark1: return("상어1");

            case accident.shark2: return("상어2");

            case accident.fire: return("화재");

            case accident.seaweed: return("수초");

            case accident.seiren: return("사이렌");

            case accident.compass: return("나침반");

            case accident.storm: return("폭풍");

            case accident.blizzard: return("눈보라");

            case accident.mouse: return("쥐");

            case accident.plague: return("전염병");

            case accident.scurvy: return("괴혈병");

            case accident.UMA: return("괴물");

            case accident.treasure1: return("何かいい物");

            case accident.treasure2: return("何か見つかるかも");

            case accident.treasure3: return("高価なもの");

            case accident.escape_battle: return("해전이탈");

            case accident.win_battle: return("해전승리");

            case accident.lose_battle: return("해전패배");

            default: return("불명");
            }
        }
Exemplo n.º 10
0
        public async Task <Unit> Handle(RegisterAccidentCommand request, CancellationToken cancellationToken)
        {
            var accident = new accident();

            accident.id                  = int.Parse(tools.generateId());
            accident.curp                = request.curp;
            accident.fecha_accidente     = request.fecha_accidente;
            accident.residuo_fisico      = request.residuo_fisico;
            accident.residuo_emocional   = request.residuo_emocional;
            accident.residuo_intelectual = request.residuo_intelectual;
            accident.residuo_intuicional = request.residuo_intuicional;

            using (var dbContextTransaction = _ctx.Database.BeginTransaction())
            {
                _ctx.accidents.Add(accident);
                await _ctx.SaveChangesAsync();

                dbContextTransaction.Commit();
            }

            return(Unit.Value);
        }
        /*-------------------------------------------------------------------------
         * アクシデントの変換
         * ---------------------------------------------------------------------------*/
        static public string ToAccidentString(accident __accident)
        {
            switch (__accident)
            {
            case accident.shark1:                   return("サメ1");

            case accident.shark2:                   return("サメ2");

            case accident.fire:                             return("火災");

            case accident.seaweed:                  return("藻");

            case accident.seiren:                   return("セイレーン");

            case accident.compass:                  return("羅針盤");

            case accident.storm:                    return("嵐");

            case accident.blizzard:                 return("吹雪");

            case accident.mouse:                    return("ネズミ");

            case accident.UMA:                              return("怪物");

            case accident.treasure1:                return("何かいい物");

            case accident.treasure2:                return("何か見つかるかも");

            case accident.treasure3:                return("高価なもの");

            case accident.escape_battle:    return("海戦離脱");

            case accident.win_battle:               return("海戦勝利");

            case accident.lose_battle:              return("海戦敗北");

            default:                                                return("なし");
            }
        }