Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="duty"></param>
        /// <returns></returns>
        public async Task <bool> UpdateAsync(Duty duty)
        {
            if (duty == null)
            {
                throw new ArgumentNullException(nameof(duty));
            }

            Duties.Update(duty);
            try
            {
                await SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="duty"></param>
        /// <returns></returns>
        public async Task <bool> CreateAsync(Duty duty)
        {
            if (duty == null)
            {
                throw new ArgumentNullException(nameof(duty));
            }

            duty.DutyPosts       = new List <DutyPost>();
            duty.DutySharedFiles = new List <DutySharedFile>();

            Duties.Add(duty);
            try
            {
                await SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                return(false);
            }

            return(true);
        }