Esempio n. 1
0
        /// <summary>
        /// Hàm delete Information
        /// </summary>
        /// <param name="input"> InformationUserDmInput_Delete </param>
        /// <returns> Emun Notify thông báo trạng thái xử lý</returns>
        public async Task <AtNotify> DeleteInfromationUser(InformationUserDmInput_Delete input)
        {
            try
            {
                if (input != null)
                {
                    var model = await _context.InfomationUser.FirstOrDefaultAsync(c => c.Id == input.Id);

                    if (!model.RowVesion.SequenceEqual(input.RowVesion))
                    {
                        return(AtNotify.PhienGiaoDichHetHan);
                    }
                    _context.InfomationUser.Remove(model);
                    await _context.SaveChangesAsync();

                    return(AtNotify.DeleteComplete);
                }
                else
                {
                    return(AtNotify.NotFound);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        public async Task <ActionResult <AtResult <InformationUserDmInput_Delete> > > DeleteInfromationUser_CallAjax([FromBody] InformationUserDmInput_Delete input_Delete)
        {
            if (input_Delete != null)
            {
                var notify = await _logicInformation.DeleteInfromationUser(input_Delete);

                if (notify == Notify.PhienGiaoDichHetHan)
                {
                    return(new AtResult <InformationUserDmInput_Delete>(Notify.PhienGiaoDichHetHan));
                }
                return(new AtResult <InformationUserDmInput_Delete>(input_Delete));
            }
            else
            {
                return(new AtResult <InformationUserDmInput_Delete>(Notify.NotFound));
            }
        }
        public async Task <ActionResult <AtResult <InformationUserDmInput_Delete> > > DeleteInfromationUser_CallAjax([FromBody] InformationUserDmInput_Delete inputData)
        {
            if (await CheckPermission(_context))
            {
                if (inputData != null)
                {
                    var notify = await _logicInformation.DeleteInfromationUser(inputData);

                    if (notify == AtNotify.PhienGiaoDichHetHan)
                    {
                        return(new AtResult <InformationUserDmInput_Delete>(AtNotify.PhienGiaoDichHetHan));
                    }
                    return(new AtResult <InformationUserDmInput_Delete>(inputData));
                }
                else
                {
                    return(new AtResult <InformationUserDmInput_Delete>(AtNotify.NotFound));
                }
            }
            else
            {
                return(new AtResult <InformationUserDmInput_Delete>(AtNotify.KhongCoQuyenTruyCap));
            }
        }