Exemple #1
0
        public async Task <NPO> CreateNewNPO(NPO npo)
        {
            npo.CreatedOn     = DateTime.Now;
            npo.LastUpdatedOn = DateTime.Now;
            _dbContext.Add(npo);
            await _dbContext.SaveChangesAsync();

            return(npo);
        }
Exemple #2
0
        /// <summary>
        /// This method is called and executed when the btnPostNewsFeed button is clicked.
        /// The new news feed that is entered is stored and posted on the system.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnPostNewsFeed_Click(object sender, EventArgs e)
        {
            if ((int)HttpContext.Current.Session["User_lvl"] == 1)
            {
                ServiceReference1.UserDetail     user    = (ServiceReference1.UserDetail)HttpContext.Current.Session["User"];
                ServiceReference1.Service1Client service = new ServiceReference1.Service1Client();
                NPOManager npoManager = new NPOManager(user.userValue.UserID, user.userValue.FirstName, user.userValue.Email);
                NewsFeed   feed       = new NewsFeed();
                feed.Title1 = txtTitle.Text;
                feed.Body1  = txtBody.Text;

                NPO npo = new NPO();
                npo.ID1 = service.getNPOWithManager(npoManager.ID1);

                npoManager.Npo = npo;

                npoManager.PostNewsFeed(feed);

                lblReply.Text = npoManager.Npo.FeedAdded;
            }
        }
Exemple #3
0
 public async Task <bool> UpdateNPO(NPO npo)
 {
     npo.LastUpdatedOn = DateTime.Now;
     _dbContext.Entry(npo).Property(x => x.Name).IsModified = true;
     return(await _dbContext.SaveChangesAsync() > 0 ? true : false);
 }