Esempio n. 1
0
        public ActionResult Editmember(loadcourseprofessors lc)
        {
            if (ModelState.IsValid)
            {
                var newmodel = new committee_Memberlist
                {
                    Uname_ofMember   = lc.email,
                    name_ofCommittee = commName,
                    member_joindate  = System.DateTime.Now,
                    memeber_endate   = System.DateTime.Now.AddYears(1),
                    active           = "yes"
                };

                _db.committee_Memberlist.Add(newmodel);
            }

            try
            {
                _db.SaveChanges();
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
            }

            return(Content("success"));
        }
Esempio n. 2
0
        public ActionResult getvalues(loadcourseprofessors lc)
        {
            System.Diagnostics.Debug.WriteLine("ans" + lc.email);


            var newmodel = new committee_Memberlist
            {
                Uname_ofMember   = lc.email,
                name_ofCommittee = commName,
                member_joindate  = System.DateTime.Now,
                memeber_endate   = System.DateTime.Now.AddYears(1),
                active           = "yes"
            };

            System.Diagnostics.Debug.WriteLine("email" + newmodel.Uname_ofMember);

            _db.committee_Memberlist.Add(newmodel);
            try
            {
                _db.SaveChanges();
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
            }



            return(RedirectToAction("Addmeetings", "UIElements"));
        }