예제 #1
0
        public ActionResult Create()
        {
            //     return View("developing");

            MissionNew acc = new MissionNew();
            return View("Create", acc);
        }
예제 #2
0
        public ActionResult Create(MissionNew missionNew)
        {
            //   return View("developing");
            missionNew.SetUser(Request.Cookies["access_token"].Value);
            if (ModelState.IsValid)
            {
                if (DataBase.Missions.create(missionNew))
                {
                    return RedirectToAction("GetById", new { id = missionNew.id });

                }
            }
            return View("Create", missionNew);
        }
예제 #3
0
파일: DataBase.cs 프로젝트: kioltk/mvc
            public static bool create(MissionNew missionNew)
            {
                int dat = Time.UNIXNow();
                string s = null;
                if (missionNew.coords != null)
                {
                    s = missionNew.coords.ToString();
                }
                var NewMission = new mission()
                {
                    title = missionNew.title,
                    description = missionNew.description,
                    additional = missionNew.additional,
                    price = missionNew.price,
                    date = Time.UNIXNow(),
                    owner = missionNew.owner,
                    cid = missionNew.cid,
                    lifetime = missionNew.lifetime,
                    coords = s,
                    status = "opened"
                };

                context.mission.InsertOnSubmit(NewMission);
                try
                {
                    Save();
                    missionNew.id = NewMission.ID;
                    return true;
                }
                catch
                {
                    return false;
                }
            }