Пример #1
0
        /// <summary>
        /// Xóa quyền
        /// </summary>
        /// <param name="input"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public async Task <AtNotify> DeleteRoleAsyns(AtRoleDmInputDelete input, string userId)
        {
            try
            {
                var model = await _context.Role.FirstOrDefaultAsync(c => c.Id == input.Id);

                if (!model.AtRowversion.SequenceEqual(input.AtRowversion))
                {
                    return(AtNotify.PhienGiaoDichHetHan);
                }
                else if (model == null)
                {
                    return(AtNotify.NotFound);
                }

                model.AtRowStatus        = (int)AtRowStatus.Hide;
                model.AtLastModifiedBy   = userId;
                model.AtLastModifiedDate = GetDateTimeFromServer();

                await _context.SaveChangesAsync();

                string data_Old = JsonConvert.SerializeObject(model);
                await WrtiteAudittingLog(new MSC_AudittingLog { Description = "Xóa ROLE ID: " + model.Id, UserID = userId, Data_Old = data_Old }, AtSerialNoConts.CODE_LOG_DELETE);

                return(AtNotify.DeleteComplete);
            }
            catch (Exception ex)
            {
                return(AtNotify.DeleteFail);
            }
        }
Пример #2
0
        public async Task <ActionResult <AtResult <AtRoleDmInputDelete> > > DeleteRole([FromBody]   AtRoleDmInputDelete input)
        {
            if (await CheckPermission(_context))
            {
                try
                {
                    if (input == null)
                    {
                        return(new AtResult <AtRoleDmInputDelete>(AtNotify.UpdateFail));
                    }

                    var ouput = await _logicRole.DeleteRoleAsyns(input, UserId);

                    if (ouput == AtNotify.PhienGiaoDichHetHan || ouput == AtNotify.NotFound)
                    {
                        return(new AtResult <AtRoleDmInputDelete>(ouput));
                    }

                    return(new AtResult <AtRoleDmInputDelete>(input));
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                return(new AtResult <AtRoleDmInputDelete>(AtNotify.KhongCoQuyenTruyCap));
            }
        }