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

            var entity = ObjectUtils.Convert <AfakulcsDto, Models.Afakulcs>(dto);
            await AfakulcsDal.ExistsAsync(context, entity);

            return(await AfakulcsDal.AddAsync(context, entity));
        }
예제 #2
0
        public static async Task DeleteAsync(ossContext context, string sid, AfakulcsDto dto)
        {
            SessionBll.Check(context, sid);
            await CsoportDal.JogeAsync(context, JogKod.PRIMITIVEKMOD);

            await AfakulcsDal.Lock(context, dto.Afakulcskod, dto.Modositva);

            await AfakulcsDal.CheckReferencesAsync(context, dto.Afakulcskod);

            var entity = await AfakulcsDal.GetAsync(context, dto.Afakulcskod);

            await AfakulcsDal.DeleteAsync(context, entity);
        }
예제 #3
0
        public static async Task <int> UpdateAsync(ossContext context, string sid, AfakulcsDto dto)
        {
            SessionBll.Check(context, sid);
            await CsoportDal.JogeAsync(context, JogKod.PRIMITIVEKMOD);

            await AfakulcsDal.Lock(context, dto.Afakulcskod, dto.Modositva);

            var entity = await AfakulcsDal.GetAsync(context, dto.Afakulcskod);

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

            return(await AfakulcsDal.UpdateAsync(context, entity));
        }
예제 #4
0
        public async Task <Int32Result> Add([FromQuery] string sid, [FromBody] AfakulcsDto dto)
        {
            var result = new Int32Result();

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

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

            return(result);
        }