예제 #1
0
        public IActionResult SingleEventViewEdit(string description, string timeOfEvent, int year, int month, int day)
        {
            SingleEventModel sem = new SingleEventModel();

            sem.descriptionOfEvent = description;
            sem.dayOfSingleEvent   = day;
            sem.monthOfSingleEvent = month;
            sem.yearOfSingleEvent  = year;
            sem.timeOfEvent        = timeOfEvent;
            readFromFile();
            SingleDayModel sdm = new SingleDayModel();

            sdm.eventsDuringTheDay = new List <SingleEventModel>();
            foreach (SingleEventModel item in ev)
            {
                if (item.dateOfSingleEvent == sem.dateOfSingleEvent)
                {
                    sdm.eventsDuringTheDay.Add(item);
                }
            }
            for (int i = 0; i < ev.Count(); i++)
            {
                if (ev[i].dayOfSingleEvent == day && ev[i].monthOfSingleEvent == month && ev[i].yearOfSingleEvent == year && ev[i].timeOfEvent == sdm.eventsDuringTheDay[sem.idEvent].timeOfEvent && ev[i].descriptionOfEvent == sdm.eventsDuringTheDay[sem.idEvent].descriptionOfEvent)
                {
                    ev[i].timeOfEvent        = timeOfEvent;
                    ev[i].descriptionOfEvent = description;
                }
            }

            saveToFile();
            return(RedirectToAction("SingleDayView", new { year = year, month = month, day = day }));
        }
예제 #2
0
        public IActionResult SingleDayView(string action, int id, int year, int month, int day)
        {
            if (action == "Delete")
            {
                SingleDayModel singleDay = new SingleDayModel();
                singleDay.yearOfSingleDay    = year;
                singleDay.monthOfSingleDay   = month;
                singleDay.dayOfSingleDay     = day;
                singleDay.eventsDuringTheDay = new List <SingleEventModel>();
                readFromFile();
                foreach (SingleEventModel sem in ev)
                {
                    if (sem.dateOfSingleEvent == singleDay.dateOfSingleDay)
                    {
                        singleDay.eventsDuringTheDay.Add(sem);
                    }
                }

                for (int i = 0; i < ev.Count(); i++)
                {
                    if (ev[i].dayOfSingleEvent == day && ev[i].monthOfSingleEvent == month && ev[i].yearOfSingleEvent == year && ev[i].timeOfEvent == singleDay.eventsDuringTheDay[id].timeOfEvent && ev[i].descriptionOfEvent == singleDay.eventsDuringTheDay[id].descriptionOfEvent)
                    {
                        ev.RemoveAt(i);
                    }
                }
                saveToFile();
                return(RedirectToAction("SingleDayView", new { year = year, month = month, day = day }));
            }
            else
            {
                return(RedirectToAction("SingleEventViewEdit", new { year = year, month = month, day = day, id = id }));
            }
        }
예제 #3
0
        public IActionResult SingleDayView(int year, int month, int day)
        {
            SingleDayModel singleDay = new SingleDayModel();

            singleDay.yearOfSingleDay    = year;
            singleDay.monthOfSingleDay   = month;
            singleDay.dayOfSingleDay     = day;
            singleDay.eventsDuringTheDay = new List <SingleEventModel>();
            readFromFile();
            foreach (SingleEventModel sem in ev)
            {
                if (sem.dateOfSingleEvent == singleDay.dateOfSingleDay)
                {
                    singleDay.eventsDuringTheDay.Add(sem);
                }
            }
            return(View(singleDay));
        }
예제 #4
0
        public IActionResult SingleEventViewEdit(int year, int month, int day, int id)
        {
            SingleEventModel singleEvent = new SingleEventModel();

            singleEvent.yearOfSingleEvent  = year;
            singleEvent.monthOfSingleEvent = month;
            singleEvent.dayOfSingleEvent   = day;
            singleEvent.idEvent            = id;
            readFromFile();
            SingleDayModel sdm = new SingleDayModel();

            sdm.eventsDuringTheDay = new List <SingleEventModel>();
            foreach (SingleEventModel sem in ev)
            {
                if (sem.dateOfSingleEvent == singleEvent.dateOfSingleEvent)
                {
                    sdm.eventsDuringTheDay.Add(sem);
                }
            }
            singleEvent.descriptionOfEvent = sdm.eventsDuringTheDay[id].descriptionOfEvent;
            singleEvent.timeOfEvent        = sdm.eventsDuringTheDay[id].timeOfEvent;
            return(View(singleEvent));
        }