Exemple #1
0
 public ActionResult SocialSchDoc(SocialMembersViewModel socialScholarshipProps, string part1, string part2, string part3, string part4)
 {
     if (socialScholarshipProps.income == null)
     {
         if (ModelState.IsValid)
         {
             socialScholarshipProps.props.bankAccountNmb      = part1 + part2 + part3 + part4;
             socialScholarshipProps.props.familyMembersIncome = socialScholarshipProps.incomes;
             socialScholarshipProps.props.docState            = DocState.sended;
             socialScholarshipProps.props.student             = db.Student.Find(getUser().student.StudentID);
             db.SocialProperties.Add(socialScholarshipProps.props);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View());
     }
     else
     {
         if (socialScholarshipProps.incomes == null)
         {
             socialScholarshipProps.incomes = new List <FamilyMembersIncome>();
         }
         socialScholarshipProps.incomes.Add(socialScholarshipProps.income);
         return(View(socialScholarshipProps));
     }
 }
Exemple #2
0
        public ActionResult SocialSchDoc()
        {
            var query2 = from dates in db.Dates where dates.what == Document.socjalny where dates.importantdate == true select dates;

            List <Dates> ListDates = query2.ToList();

            ViewBag.dateCheck = true;
            if (ListDates.Count > 0)
            {
                DateTime dt3 = DateTime.Now;
                DateTime dt1 = Convert.ToDateTime(ListDates.ElementAt(0).startdate);
                DateTime dt2 = Convert.ToDateTime(ListDates.ElementAt(0).enddate);


                if (dt1.Date <= dt3.Date && dt3.Date <= dt2.Date)
                {
                    ViewBag.dateCheck = false;
                }
            }
            else
            {
                ViewBag.dateCheck = false;
            }

            ApplicationUser user = getUser();

            ViewBag.isSended = false;

            if (user.student != null)
            {
                int id    = user.student.StudentID;
                var props = from docs in db.SocialProperties where docs.student.StudentID == id select docs;

                if (props.Any())
                {
                    ViewBag.isSended = true;
                    SocialMembersViewModel model = new SocialMembersViewModel();
                    model.props = props.First();
                    return(View(model));
                }
            }
            else
            {
                return(RedirectToAction("BasicDoc", "Home"));
            }
            return(View());
        }