Beispiel #1
0
        /// <summary>
        /// Delete User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> DeleteTypeOfJob(int TypeOfJobId)
        {
            #region Declare a return type with initial value.
            bool isTypeOfJobDeleted = default(bool);
            #endregion
            try
            {
                if (TypeOfJobId > default(int))
                {
                    #region Vars
                    TypeOfJob TypeOfJob = null;
                    #endregion
                    #region Get TypeOfJob by id
                    TypeOfJob = await UnitOfWork.TypeOfJobRepository.GetById(TypeOfJobId);

                    #endregion
                    #region check if object is not null
                    if (TypeOfJob != null)
                    {
                        TypeOfJob.IsDeleted = (byte)DeleteStatusEnum.Deleted;
                        #region Apply the changes to the database
                        UnitOfWork.TypeOfJobRepository.Update(TypeOfJob);
                        isTypeOfJobDeleted = await UnitOfWork.Commit() > default(int);

                        #endregion
                    }
                    #endregion
                }
            }
            catch (Exception exception)
            {
            }
            return(isTypeOfJobDeleted);
        }
Beispiel #2
0
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TypeOfJob = await _context.TypeOfJob.FirstOrDefaultAsync(m => m.ID == id);

            if (TypeOfJob == null)
            {
                return(NotFound());
            }
            return(Page());
        }
 /// <summary>
 /// Mapping User Activity Log DTO to Action
 /// </summary>
 /// <param name=></param>
 /// <param name=></param>
 /// <returns></returns>
 public TypeOfJob MappingTypeOfJobupdateDTOToTypeOfJob(TypeOfJob typeOfJob, TypeOfJobUpdateDTO TypeOfJobUpdateDTO)
 {
     #region Declare Return Var with Intial Value
     TypeOfJob TypeOfJob = typeOfJob;
     #endregion
     try
     {
         if (TypeOfJobUpdateDTO.TypeOfJobId > default(int))
         {
             TypeOfJob.TypeOfJobId   = TypeOfJobUpdateDTO.TypeOfJobId;
             TypeOfJob.TypeOfJobName = TypeOfJobUpdateDTO.TypeOfJobName;
         }
     }
     catch (Exception exception) { }
     return(TypeOfJob);
 }
 /// <summary>
 /// Mapping user Action Actitvity Log
 /// </summary>
 /// <param name=></ param >
 /// <returns>Task<TypeOfJob></returns>
 public TypeOfJob MappingTypeOfJobAddDTOToTypeOfJob(TypeOfJobAddDTO TypeOfJobAddDTO)
 {
     #region Declare a return type with initial value.
     TypeOfJob TypeOfJob = null;
     #endregion
     try
     {
         TypeOfJob = new TypeOfJob
         {
             TypeOfJobName = TypeOfJobAddDTO.TypeOfJobName,
             CreationDate  = DateTime.Now,
             IsDeleted     = (byte)DeleteStatusEnum.NotDeleted
         };
     }
     catch (Exception exception) { }
     return(TypeOfJob);
 }
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            TypeOfJob = await _context.TypeOfJob.FindAsync(id);

            if (TypeOfJob != null)
            {
                _context.TypeOfJob.Remove(TypeOfJob);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
 public TypeOfJobReturnDTO MappingTypeOfJobToTypeOfJobReturnDTO(TypeOfJob TypeOfJob)
 {
     #region Declare a return type with initial value.
     TypeOfJobReturnDTO TypeOfJobReturnDTO = null;
     #endregion
     try
     {
         if (TypeOfJob != null)
         {
             TypeOfJobReturnDTO = new TypeOfJobReturnDTO
             {
                 TypeOfJobId   = TypeOfJob.TypeOfJobId,
                 TypeOfJobName = TypeOfJob.TypeOfJobName
             };
         }
     }
     catch (Exception exception)
     { }
     return(TypeOfJobReturnDTO);
 }
Beispiel #7
0
        /// <summary>
        /// Get user Action Activity Log By Id
        /// </summary>
        /// <returns>List<TypeOfJobReturnDTO></returns>
        public async Task <TypeOfJobReturnDTO> GetTypeOfJobById(int TypeOfJobId)
        {
            #region Declare a return type with initial value.
            TypeOfJobReturnDTO TypeOfJob = new TypeOfJobReturnDTO();
            #endregion
            try
            {
                TypeOfJob typeOfJob = await UnitOfWork.TypeOfJobRepository.GetById(TypeOfJobId);

                if (typeOfJob != null)
                {
                    if (typeOfJob.IsDeleted != (byte)DeleteStatusEnum.Deleted)
                    {
                        TypeOfJob = TypeOfJobMapping.MappingTypeOfJobToTypeOfJobReturnDTO(typeOfJob);
                    }
                }
            }
            catch (Exception exception)
            {
            }
            return(TypeOfJob);
        }
Beispiel #8
0
        /// <summary>
        /// Create User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> AddTypeOfJob(TypeOfJobAddDTO TypeOfJobAddDTO)
        {
            #region Declare a return type with initial value.
            bool isTypeOfJobCreated = default(bool);
            #endregion
            try
            {
                #region Vars
                TypeOfJob TypeOfJob = null;
                #endregion
                TypeOfJob = TypeOfJobMapping.MappingTypeOfJobAddDTOToTypeOfJob(TypeOfJobAddDTO);
                if (TypeOfJob != null)
                {
                    await UnitOfWork.TypeOfJobRepository.Insert(TypeOfJob);

                    isTypeOfJobCreated = await UnitOfWork.Commit() > default(int);
                }
            }
            catch (Exception exception)
            {
            }
            return(isTypeOfJobCreated);
        }
Beispiel #9
0
        /// <summary>
        /// Update User Action Activity Log
        /// </summary>
        /// <param name=></param>
        /// <returns>bool</returns>
        public async Task <bool> UpdateTypeOfJob(TypeOfJobUpdateDTO TypeOfJobUpdateDTO)
        {
            #region Declare a return type with initial value.
            bool isTypeOfJobUpdated = default(bool);
            #endregion
            try
            {
                if (TypeOfJobUpdateDTO != null)
                {
                    #region Vars
                    TypeOfJob TypeOfJob = null;
                    #endregion
                    #region Get Activity By Id
                    TypeOfJob = await UnitOfWork.TypeOfJobRepository.GetById(TypeOfJobUpdateDTO.TypeOfJobId);

                    #endregion
                    if (TypeOfJob != null)
                    {
                        #region  Mapping
                        TypeOfJob = TypeOfJobMapping.MappingTypeOfJobupdateDTOToTypeOfJob(TypeOfJob, TypeOfJobUpdateDTO);
                        #endregion
                        if (TypeOfJob != null)
                        {
                            #region  Update Entity
                            UnitOfWork.TypeOfJobRepository.Update(TypeOfJob);
                            isTypeOfJobUpdated = await UnitOfWork.Commit() > default(int);

                            #endregion
                        }
                    }
                }
            }
            catch (Exception exception)
            {
            }
            return(isTypeOfJobUpdated);
        }