예제 #1
0
        public async Task <IActionResult> PutSpecialization(int id, Specialization specialization)
        {
            if (id != specialization.SpecializationID)
            {
                return(BadRequest());
            }

            _context.Entry(specialization).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SpecializationExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public async Task <IActionResult> PutSubCompetetionType(int id, SubCompetetionType subCompetetionType)
        {
            if (id != subCompetetionType.SubCompetetionTypeID)
            {
                return(BadRequest());
            }

            _context.Entry(subCompetetionType).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SubCompetetionTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutImage(int id, Image image)
        {
            if (id != image.ImageId)
            {
                return(BadRequest());
            }

            _context.Entry(image).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ImageExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #4
0
        public async Task <Models.Competetion.Question> UpdateQuestion(APIModel.Competetion.Question question)
        {
            var ques = this.QuestionMap(question);

            _context.Entry(ques).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(ques);
        }
        public async Task <Models.Competetion.CompetetionStatistic> UpdateStatisticInfo(StatisticInfoDTO statisticInfo)
        {
            Models.Competetion.CompetetionStatistic competetionStatistic = await _context.CompetetionStatistics.FindAsync(statisticInfo.CompetetionStatisticsID);

            competetionStatistic.MaleSuccessfulPercentage   = statisticInfo.MaleSuccessfulPercentage;
            competetionStatistic.FemaleSuccessfulPercentage = statisticInfo.FemaleSuccessfulPercentage;
            competetionStatistic.TotalSuccessfulPercentage  = statisticInfo.TotalSuccessfulPercentage;

            _context.Entry(competetionStatistic).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            return(competetionStatistic);
        }
예제 #6
0
 public void UpdateAsync(T obj)
 {
     table.Attach(obj);
     _context.Entry(obj).State = EntityState.Modified;
 }
 private async Task UpdateTotalMark(Models.Competetion.TotalMark totalMark)
 {
     _context.Entry(totalMark).State = EntityState.Modified;
     await _context.SaveChangesAsync();
 }