public async Task <ActionResult <bool> > SaveOrganisationPost(OrganisationPost OrgPost)
        {
            try
            {
                _context.OrganisationPosts.Add(OrgPost);
                await _context.SaveChangesAsync();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public async Task <ActionResult <bool> > EditOrganisationPost(OrganisationPost OrgPost)
        {
            var orgPostsEdit = await _context.OrganisationPosts.FirstOrDefaultAsync(x => x.ID == OrgPost.ID);

            if (orgPostsEdit == null)
            {
                return(false);
            }
            else
            {
                try
                {
                    if (orgPostsEdit.ImagePath != null)
                    {
                        ImageDelete imgDelete = new ImageDelete();
                        imgDelete.ImageDeleteURL(orgPostsEdit.ImagePath);
                    }

                    orgPostsEdit.Text           = OrgPost.Text;
                    orgPostsEdit.ImagePath      = OrgPost.ImagePath;
                    orgPostsEdit.Time           = OrgPost.Time;
                    orgPostsEdit.OrganisationID = OrgPost.OrganisationID;


                    _context.OrganisationPosts.Update(orgPostsEdit);

                    _context.SaveChanges();

                    return(true);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }
 public Task <ActionResult <bool> > SaveOrganisationPost(OrganisationPost OrgPost)
 {
     return(_IOrganisationPostsBL.SaveOrganisationPost(OrgPost));
 }
Beispiel #4
0
 public async Task <ActionResult <bool> > AddOrganisationPost(OrganisationPost OrgPost)
 {
     return(await _IOrganisationPostsUI.SaveOrganisationPost(OrgPost));
 }
Beispiel #5
0
 public async Task <ActionResult <bool> > EditOrganisationPost(OrganisationPost orgPost)
 {
     return(await _IOrganisationPostsUI.EditOrganisationPost(orgPost));
 }
 public Task <ActionResult <bool> > EditOrganisationPost(OrganisationPost OrgPost)
 {
     return(_IOrganisationPostsDAL.EditOrganisationPost(OrgPost));
 }