Пример #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
            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;
                }
            }