コード例 #1
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add update logic here
                IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();
                MeetingLib            m             = MeetingLibRep.getMeetingLibByID(id);

                m.MeetingLibDesc   = collection["meeting_description"];
                m.MeetingLibNumber = collection["meeting_number"];
                m.MeetingLibDate   = DateTime.Parse(collection["meeting_date"]);
                m.DateModified     = DateTime.Now;

                MeetingLibRep.Save(m);

                return(RedirectToAction("Index"));
            }
            catch (SubSonic.SqlQueryException e)
            {
                Console.WriteLine("{0} Exception caught.", e.Message);
                IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();
                MeetingLib            m             = MeetingLibRep.getMeetingLibByID(id);
                ViewData.Model = m;
                return(View());
            }
        }
コード例 #2
0
ファイル: MeetingLibTest.cs プロジェクト: Vladimir12/sigtrade
        public void Update_Meeting_Lib()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib     m    = MeetingLibRep.getMeetingLibByID(2);
            FormCollection form = new FormCollection();

            form["MeetingLibNumber"] = "x";
            form["MeetingLibDesc"]   = "xy";
            form["MeetingLibDate"]   = "01/01/2009";

            m.MeetingLibDesc   = form["MeetingLibDesc"];
            m.MeetingLibNumber = form["MeetingLibNumber"];
            m.MeetingLibDate   = DateTime.Parse(form["MeetingLibDate"]);


            MeetingLibRep.Save(m);

            Assert.AreEqual(MeetingLibRep.Save(m), 0);
        }
コード例 #3
0
ファイル: MeetingLibTest.cs プロジェクト: Vladimir12/sigtrade
        public void Modify_MeetingLib()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(2);

            m.MeetingLibDesc = "PLants Committee";
            m.DateModified   = DateTime.Now;

            int saved = MeetingLibRep.Save(m);

            Assert.AreEqual(saved, 1);
        }
コード例 #4
0
ファイル: MeetingLibTest.cs プロジェクト: Vladimir12/sigtrade
        public void Adding_MeetingLib()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = new MeetingLib();

            IList <SelectItems> allItems = new List <SelectItems>();

            allItems.ToPagedList(0, 10);

            m.MeetingLibDesc   = "Plants";
            m.MeetingLibNumber = "PL01";
            m.MeetingLibDate   = DateTime.Parse("02/02/2009");
            m.DateAdded        = DateTime.Now;
            m.DateModified     = DateTime.Now;

            int saved = MeetingLibRep.Save(m);

            Assert.AreEqual(saved, 3);
        }