getMeetingLibByID() public method

public getMeetingLibByID ( int ID ) : MeetingLib
ID int
return MeetingLib
コード例 #1
0
ファイル: MeetingLibTest.cs プロジェクト: unepwcmc/sigtrade
        public void Delete_MeetingLib()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(2);

            MeetingLibRep.Delete(m);

            m = MeetingLibRep.getMeetingLibByID(2);

            Assert.IsTrue(m.Deleted == true);
        }
コード例 #2
0
        public ActionResult delete(int id)
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();
            MeetingLib ml = new MeetingLib();

            //GET MEETING
            try
            {
                ml = MeetingLibRep.getMeetingLibByID(id);
            }
            catch (Exception exception)
            {
                //IF THERE IS A MESS UP, RETURN ERROR TO FRONT
                TempData["flash"] = "Unable to retrieve meeting: " + exception.Message;
                return RedirectToAction("Index");
            }

            //DELETE MEETING
            try
            {
                MeetingLibRep.Delete(ml);
                TempData["flash"] = "Deleted meeting.";
                return RedirectToAction("Index");
            }
            catch (Exception exception)
            {
                TempData["flash"] = "Unable to delete meeting: " + exception.Message;
                return RedirectToAction("Index");
            }
        }
コード例 #3
0
ファイル: MeetingLibTest.cs プロジェクト: unepwcmc/sigtrade
        public void MeetingLibs_Get_By_ID()
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(1);

            Assert.AreEqual(m.MeetingLibDesc,"Animal");
        }
コード例 #4
0
ファイル: MeetingLibTest.cs プロジェクト: unepwcmc/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);
        }
コード例 #5
0
ファイル: MeetingLibTest.cs プロジェクト: unepwcmc/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);
        }
コード例 #6
0
        public ActionResult Edit(int id)
        {
            IMeetingLibRepository MeetingLibRep = new MeetingLibRepository();

            MeetingLib m = MeetingLibRep.getMeetingLibByID(id);
            ViewData.Model = m;
            return View();
        }
コード例 #7
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();
            }
        }