Exemple #1
0
        public static async Task <int> AddAsync(ossContext context, string sid, CsoportDto dto)
        {
            SessionBll.Check(context, sid);
            await CsoportDal.JogeAsync(context, JogKod.CSOPORT);

            var entity = ObjectUtils.Convert <CsoportDto, Models.Csoport>(dto);
            await CsoportDal.ExistsAsync(context, entity);

            return(await CsoportDal.AddAsync(context, entity));
        }
Exemple #2
0
        public static async Task DeleteAsync(ossContext context, string sid, CsoportDto dto)
        {
            SessionBll.Check(context, sid);
            await CsoportDal.JogeAsync(context, JogKod.CSOPORT);

            await CsoportDal.Lock(context, dto.Csoportkod, dto.Modositva);

            await CsoportDal.CheckReferencesAsync(context, dto.Csoportkod);

            var entity = await CsoportDal.GetAsync(context, dto.Csoportkod);

            await CsoportDal.DeleteAsync(context, entity);
        }
Exemple #3
0
        public static async Task <int> UpdateAsync(ossContext context, string sid, CsoportDto dto)
        {
            SessionBll.Check(context, sid);
            await CsoportDal.JogeAsync(context, JogKod.CSOPORT);

            await CsoportDal.Lock(context, dto.Csoportkod, dto.Modositva);

            var entity = await CsoportDal.GetAsync(context, dto.Csoportkod);

            ObjectUtils.Update(dto, entity);
            await CsoportDal.ExistsAnotherAsync(context, entity);

            return(await CsoportDal.UpdateAsync(context, entity));
        }
        public async Task <Int32Result> Add([FromQuery] string sid, [FromBody] CsoportDto dto)
        {
            var result = new Int32Result();

            using (var tr = await _context.Database.BeginTransactionAsync())
                try
                {
                    result.Result = await CsoportBll.AddAsync(_context, sid, dto);

                    tr.Commit();
                }
                catch (Exception ex)
                {
                    tr.Rollback();
                    result.Error = ex.InmostMessage();
                }

            return(result);
        }