示例#1
0
 public static MotionDetail ToDetail(this MotionEntity entity)
 {
     return(new MotionDetail
     {
         MotionId = entity.Id,
         Title = entity.Title,
         Description = entity.Description,
         PresenterName = entity.PresentingUser.UserName,
         OriginalSessionId = entity.OriginalSessionId,
         IsActive = entity.IsActive,
         IsTabled = entity.IsTabled,
         Votes = entity.Votes.Select(v => v.ToDetail()).ToList()
     });
 }
示例#2
0
        // CREATE New
        public async Task <bool> CreateMotionAsync(MotionCreate model)
        {
            var currentSession = await _context.Sessions.FirstOrDefaultAsync(s => s.IsActive);

            if (currentSession == null)
            {
                return(false);
            }

            var newMotion = new MotionEntity
            {
                Title            = model.Title,
                Description      = model.Description,
                IsActive         = true,
                IsTabled         = false,
                PresentingUserId = _userId
            };

            currentSession.OrdersOfBusiness.Add(newMotion);

            return(await _context.SaveChangesAsync() == 1);
        }