Ejemplo n.º 1
0
        public EmailResponseDto <string> DeleteEmailPool(string poolID)
        {
            var response = new EmailResponseDto <string>();

            try
            {
                var queryResult = _context.EmailPools.Where(sp => sp.ID.ToLower().Equals(poolID.ToLower())).FirstOrDefault();
                if (queryResult != null)
                {
                    _context.Remove(queryResult);
                    if (_context.SaveChanges() == 1)
                    {
                        response.Status  = true;
                        response.Message = "Deleted";
                    }
                    else
                    {
                        response.Status  = false;
                        response.Message = "Not Deleted";
                    }
                }
                else
                {
                    response.Status  = false;
                    response.Message = "No Record found.";
                }
                return(response);
            }
            catch (Exception ex)
            {
                response.Status  = false;
                response.Message = ex.Message;
                return(response);
            }
        }