Ejemplo n.º 1
0
        public async Task <bool> UpdateEssayAync(UpdateEssayModel updateEssayModel)
        {
            try
            {
                this.essaysRepository.Update(this.GenerateEssay(updateEssayModel));
            }
            catch (System.Exception ex)
            {
                return(false);
            }

            await this.essaysRepository.SaveChangesAsync();

            return(true);
        }
Ejemplo n.º 2
0
        private Essay GenerateEssay(UpdateEssayModel updateEssayModel)
        {
            var   createdOn = this.essaysRepository.AllAsNoTracking().First(x => x.Id == updateEssayModel.Id).CreatedOn;
            Essay essay     = new Essay()
            {
                Id          = updateEssayModel.Id,
                ImageUrl    = updateEssayModel.ImageUrl,
                UserId      = updateEssayModel.UserId,
                Title       = updateEssayModel.Title,
                Description = updateEssayModel.Description,
                Content     = updateEssayModel.Content,
                Graded      = true,
                ContestId   = updateEssayModel.ContestId,
                CreatedOn   = createdOn,
            };

            return(essay);
        }